MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_deferred_autoflushes

Method test_deferred_autoflushes

test/orm/test_deferred.py:2800–2820  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2798 )
2799
2800 def test_deferred_autoflushes(self):
2801 A, B = self.classes("A", "B")
2802
2803 s = fixture_session()
2804
2805 a1 = A(id=1, bs=[B()])
2806 s.add(a1)
2807 s.commit()
2808
2809 eq_(a1.b_count, 1)
2810 s.close()
2811
2812 a1 = s.query(A).first()
2813 assert "b_count" not in a1.__dict__
2814
2815 b1 = B(a_id=1)
2816 s.add(b1)
2817
2818 eq_(a1.b_count, 2)
2819
2820 assert b1 in s
2821
2822
2823class DeferredPopulationTest(fixtures.MappedTest):

Callers

nothing calls this directly

Calls 9

fixture_sessionFunction · 0.90
eq_Function · 0.90
AClass · 0.70
BClass · 0.70
addMethod · 0.45
commitMethod · 0.45
closeMethod · 0.45
firstMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected