MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / dict_collection

Method dict_collection

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

Source from the content-addressed store, hash-verified

3196class CollectionKeyTest(fixtures.ORMTest):
3197 @testing.fixture
3198 def dict_collection(self):
3199 class Foo(BasicEntity):
3200 pass
3201
3202 class Bar(BasicEntity):
3203 def __init__(self, name):
3204 self.name = name
3205
3206 instrumentation.register_class(Foo)
3207 instrumentation.register_class(Bar)
3208 _register_attribute(
3209 Foo,
3210 "someattr",
3211 uselist=True,
3212 useobject=True,
3213 typecallable=attribute_keyed_dict("name"),
3214 )
3215 _register_attribute(
3216 Bar,
3217 "name",
3218 uselist=False,
3219 useobject=False,
3220 )
3221
3222 return Foo, Bar
3223
3224 @testing.fixture
3225 def list_collection(self):

Callers

nothing calls this directly

Calls 2

attribute_keyed_dictFunction · 0.85
_register_attributeFunction · 0.70

Tested by

no test coverage detected