MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_no_double_state

Method test_no_double_state

test/orm/test_attributes.py:719–736  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

717 assert y.element2 == "this is the shared attr"
718
719 def test_no_double_state(self):
720 states = set()
721
722 class Foo:
723 def __init__(self):
724 states.add(attributes.instance_state(self))
725
726 class Bar(Foo):
727 def __init__(self):
728 states.add(attributes.instance_state(self))
729 Foo.__init__(self)
730
731 instrumentation.register_class(Foo)
732 instrumentation.register_class(Bar)
733
734 b = Bar()
735 eq_(len(states), 1)
736 eq_(list(states)[0].obj(), b)
737
738 def test_inheritance2(self):
739 """test that the attribute manager can properly traverse the

Callers

nothing calls this directly

Calls 2

eq_Function · 0.90
BarClass · 0.70

Tested by

no test coverage detected