Skip to content

Commit 8e2a5b4

Browse files
committed
Add unittests for python bindings
1 parent 20bdf0d commit 8e2a5b4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

python/podio/test_Frame.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ def test_frame_empty_parameters(self):
152152
vals = frame.get_parameter("empty_param")
153153
self.assertEqual(len(vals), 0)
154154

155+
def test_frame_get_collection_from_object(self):
156+
"""Check that using an object (handle) to get a collection works"""
157+
frame = Frame()
158+
hits = ExampleHitCollection()
159+
hit = hits.create()
160+
161+
with self.assertRaises(ReferenceError):
162+
invalidHits = frame.get(hit)
163+
_ = invalidHits[0]
164+
165+
hits = frame.put(hits, "hits")
166+
hitsFromHit = frame.get(hit)
167+
self.assertEqual(hit, hitsFromHit[0])
168+
155169

156170
class FrameReadTest(unittest.TestCase):
157171
"""Unit tests for the Frame python bindings for Frames read from file.

0 commit comments

Comments
 (0)