MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_synonym

Method test_synonym

test/orm/test_merge.py:1498–1520  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1496 assert_.assert_(CountStatements(0))
1497
1498 def test_synonym(self):
1499 users = self.tables.users
1500
1501 class User:
1502 def _getValue(self):
1503 return self._value
1504
1505 def _setValue(self, value):
1506 setattr(self, "_value", value)
1507
1508 value = property(_getValue, _setValue)
1509
1510 self.mapper_registry.map_imperatively(
1511 User, users, properties={"uid": synonym("id")}
1512 )
1513
1514 sess = fixture_session()
1515 u = User()
1516 u.name = "ed"
1517 sess.add(u)
1518 sess.flush()
1519 sess.expunge(u)
1520 sess.merge(u)
1521
1522 def test_cascade_doesnt_blowaway_manytoone(self):
1523 """a merge test that was fixed by [ticket:1202]"""

Callers

nothing calls this directly

Calls 8

synonymFunction · 0.90
fixture_sessionFunction · 0.90
map_imperativelyMethod · 0.80
UserClass · 0.70
addMethod · 0.45
flushMethod · 0.45
expungeMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected