MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_detached_all_empty_list

Method test_detached_all_empty_list

test/orm/test_dynamic.py:318–339  ·  view source on GitHub ↗

test #6426 - but you can call .all() on it and you get an empty list. This is legacy stuff, as this should be raising DetachedInstanceError.

(self, user_address_fixture)

Source from the content-addressed store, hash-verified

316 )
317
318 def test_detached_all_empty_list(self, user_address_fixture):
319 """test #6426 - but you can call .all() on it and you get an empty
320 list. This is legacy stuff, as this should be raising
321 DetachedInstanceError.
322
323 """
324
325 User, Address = user_address_fixture()
326
327 sess = fixture_session()
328 u = sess.get(User, 8)
329 sess.expunge(u)
330
331 with testing.expect_warnings(
332 r"Instance <User .*> is detached, dynamic relationship"
333 ):
334 eq_(u.addresses.all(), [])
335
336 with testing.expect_warnings(
337 r"Instance <User .*> is detached, dynamic relationship"
338 ):
339 eq_(list(u.addresses), [])
340
341 def test_transient_all_empty_list(self, user_address_fixture):
342 User, Address = user_address_fixture()

Callers

nothing calls this directly

Calls 5

fixture_sessionFunction · 0.90
eq_Function · 0.90
getMethod · 0.45
expungeMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected