MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_none_entity

Method test_none_entity

test/orm/test_deprecations.py:2887–2905  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2885 eq_(list(it[0]._mapping.keys()), ["User", "id"])
2886
2887 def test_none_entity(self):
2888 s, (u1, u2, u3, u4) = self._fixture()
2889 User = self.classes.User
2890
2891 ua = aliased(User)
2892 q = s.query(User, ua)
2893
2894 row = result_tuple(["User", "useralias"])
2895
2896 def kt(*x):
2897 return row(x)
2898
2899 collection = [kt(u1, u2), kt(u1, None), kt(u2, u3)]
2900 with assertions.expect_deprecated_20(merge_result_dep):
2901 it = q.merge_result(collection)
2902 eq_(
2903 [(x and x.id or None, y and y.id or None) for x, y in it],
2904 [(u1.id, u2.id), (u1.id, None), (u2.id, u3.id)],
2905 )
2906
2907
2908class DefaultStrategyOptionsTest(_DefaultStrategyOptionsTest):

Callers

nothing calls this directly

Calls 6

_fixtureMethod · 0.95
aliasedFunction · 0.90
result_tupleFunction · 0.90
eq_Function · 0.90
merge_resultMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected