@@ -47,3 +47,44 @@ async def test_orm_integration():
4747 # verify deletion
4848 thing4 = await IntegrationTestModel .get (thing .uid )
4949 assert thing4 is None
50+
51+
52+ @pytest .mark .asyncio
53+ async def test_get_many ():
54+ """Integration test for get_many method."""
55+ # create multiple things
56+ thing1 = await IntegrationTestModel .create (text = "item1" )
57+ thing2 = await IntegrationTestModel .create (text = "item2" )
58+ thing3 = await IntegrationTestModel .create (text = "item3" )
59+
60+ try :
61+ # get_many with all uids
62+ results = await IntegrationTestModel .get_many ([thing1 .uid , thing2 .uid , thing3 .uid ])
63+ assert len (results ) == 3
64+ assert isinstance (results , dict )
65+ assert results [thing1 .uid ].text == "item1"
66+ assert results [thing2 .uid ].text == "item2"
67+ assert results [thing3 .uid ].text == "item3"
68+
69+ # get_many with subset of uids
70+ results = await IntegrationTestModel .get_many ([thing1 .uid , thing3 .uid ])
71+ assert len (results ) == 2
72+ assert thing1 .uid in results
73+ assert thing2 .uid not in results
74+ assert thing3 .uid in results
75+
76+ # get_many with empty list
77+ results = await IntegrationTestModel .get_many ([])
78+ assert results == {}
79+
80+ # get_many with non-existent uid
81+ results = await IntegrationTestModel .get_many ([thing1 .uid , "non_existent_uid" ])
82+ assert len (results ) == 1
83+ assert thing1 .uid in results
84+ assert "non_existent_uid" not in results
85+
86+ finally :
87+ # cleanup
88+ await thing1 .delete ()
89+ await thing2 .delete ()
90+ await thing3 .delete ()
0 commit comments