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

Method test_not_none

test/orm/test_composites.py:164–186  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

162 eq_(e.end, Point(18, 4))
163
164 def test_not_none(self):
165 Edge = self.classes.Edge
166
167 # current contract. the composite is None
168 # when hasn't been populated etc. on a
169 # pending/transient object.
170 e1 = Edge()
171 assert e1.end is None
172 sess = fixture_session()
173 sess.add(e1)
174
175 # however, once it's persistent, the code as of 0.7.3
176 # would unconditionally populate it, even though it's
177 # all None. I think this usage contract is inconsistent,
178 # and it would be better that the composite is just
179 # created unconditionally in all cases.
180 # but as we are just trying to fix [ticket:2308] and
181 # [ticket:2309] without changing behavior we maintain
182 # that only "persistent" gets the composite with the
183 # Nones
184
185 sess.flush()
186 assert e1.end is not None
187
188 def test_eager_load(self):
189 Graph, Point = self.classes.Graph, self.classes.Point

Callers

nothing calls this directly

Calls 4

fixture_sessionFunction · 0.90
EdgeClass · 0.70
addMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected