MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_synonym_get_history

Method test_synonym_get_history

test/orm/test_mapper.py:2098–2117  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2096 eq_(u.y, 8)
2097
2098 def test_synonym_get_history(self):
2099 users, User = (self.tables.users, self.classes.User)
2100
2101 self.mapper(
2102 User, users, properties={"x": synonym("id"), "y": synonym("x")}
2103 )
2104
2105 u1 = User()
2106 eq_(
2107 attributes.instance_state(u1).attrs.x.history,
2108 attributes.HISTORY_BLANK,
2109 )
2110 eq_(
2111 attributes.instance_state(u1).attrs.y.history,
2112 attributes.HISTORY_BLANK,
2113 )
2114
2115 u1.y = 5
2116 eq_(attributes.instance_state(u1).attrs.x.history, ([5], (), ()))
2117 eq_(attributes.instance_state(u1).attrs.y.history, ([5], (), ()))
2118
2119 def test_synonym_nonexistent_attr(self):
2120 # test [ticket:4767].

Callers

nothing calls this directly

Calls 4

synonymFunction · 0.90
eq_Function · 0.90
UserClass · 0.70
mapperMethod · 0.45

Tested by

no test coverage detected