MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_none_entity

Method test_none_entity

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

Source from the content-addressed store, hash-verified

2026 eq_(list(it[0]._mapping.keys()), ["User", "id"])
2027
2028 def test_none_entity(self):
2029 s, (u1, u2, u3, u4) = self._fixture()
2030 User = self.classes.User
2031
2032 ua = aliased(User)
2033 q = s.query(User, ua)
2034
2035 row = result_tuple(["User", "useralias"])
2036
2037 def kt(*x):
2038 return row(x)
2039
2040 collection = [kt(u1, u2), kt(u1, None), kt(u2, u3)]
2041 with assertions.expect_deprecated_20(merge_result_dep):
2042 it = q.merge_result(collection)
2043 eq_(
2044 [(x and x.id or None, y and y.id or None) for x, y in it],
2045 [(u1.id, u2.id), (u1.id, None), (u2.id, u3.id)],
2046 )
2047
2048
2049class DefaultStrategyOptionsTest(DefaultStrategyOptionsTestFixtures):

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