MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _fixture

Method _fixture

test/orm/test_attributes.py:999–1027  ·  view source on GitHub ↗
(self, expected)

Source from the content-addressed store, hash-verified

997
998class GetNoValueTest(fixtures.ORMTest):
999 def _fixture(self, expected):
1000 class Foo:
1001 pass
1002
1003 class Bar:
1004 pass
1005
1006 def lazy_callable(state, passive):
1007 return expected
1008
1009 instrumentation.register_class(Foo)
1010 instrumentation.register_class(Bar)
1011 if expected is not None:
1012 _register_attribute(
1013 Foo,
1014 "attr",
1015 useobject=True,
1016 uselist=False,
1017 callable_=lazy_callable,
1018 )
1019 else:
1020 _register_attribute(Foo, "attr", useobject=True, uselist=False)
1021
1022 f1 = self.f1 = Foo()
1023 return (
1024 Foo.attr.impl,
1025 attributes.instance_state(f1),
1026 attributes.instance_dict(f1),
1027 )
1028
1029 def test_passive_no_result(self):
1030 attr, state, dict_ = self._fixture(attributes.PASSIVE_NO_RESULT)

Calls 2

_register_attributeFunction · 0.70
FooClass · 0.70

Tested by

no test coverage detected