MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _test_roundtrip

Method _test_roundtrip

test/orm/test_composites.py:1516–1536  ·  view source on GitHub ↗
(self, *, assert_deferred=False, options=())

Source from the content-addressed store, hash-verified

1514 pass
1515
1516 def _test_roundtrip(self, *, assert_deferred=False, options=()):
1517 Edge, Point = self.classes.Edge, self.classes.Point
1518
1519 e1 = Edge(start=Point(3, 4), end=Point(5, 6))
1520 sess = fixture_session()
1521 sess.add(e1)
1522 sess.commit()
1523
1524 stmt = select(Edge)
1525 if options:
1526 stmt = stmt.options(*options)
1527 e1 = sess.execute(stmt).scalar_one()
1528
1529 names = ["start", "end", "x1", "x2", "y1", "y2"]
1530 for name in names:
1531 if assert_deferred:
1532 assert name not in e1.__dict__
1533 else:
1534 assert name in e1.__dict__
1535
1536 eq_(e1, Edge(start=Point(3, 4), end=Point(5, 6)))
1537
1538 def test_columns(self):
1539 edge, Edge, Point = (

Calls 10

fixture_sessionFunction · 0.90
selectFunction · 0.90
eq_Function · 0.90
EdgeClass · 0.70
PointClass · 0.70
addMethod · 0.45
commitMethod · 0.45
optionsMethod · 0.45
scalar_oneMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected