MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_transient

Method test_transient

test/orm/test_pickled.py:130–150  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

128 return sess, User, Address, Dingaling
129
130 def test_transient(self):
131 users, addresses = (self.tables.users, self.tables.addresses)
132
133 self.mapper_registry.map_imperatively(
134 User,
135 users,
136 properties={"addresses": relationship(Address, backref="user")},
137 )
138 self.mapper_registry.map_imperatively(Address, addresses)
139
140 sess = fixture_session()
141 u1 = User(name="ed")
142 u1.addresses.append(Address(email_address="ed@bar.com"))
143
144 u2 = pickle.loads(pickle.dumps(u1))
145 sess.add(u2)
146 sess.flush()
147
148 sess.expunge_all()
149
150 eq_(u1, sess.get(User, u2.id))
151
152 def test_no_mappers(self):
153 users = self.tables.users

Callers

nothing calls this directly

Calls 13

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
UserClass · 0.90
AddressClass · 0.90
eq_Function · 0.90
map_imperativelyMethod · 0.80
appendMethod · 0.45
loadsMethod · 0.45
dumpsMethod · 0.45
addMethod · 0.45
flushMethod · 0.45
expunge_allMethod · 0.45

Tested by

no test coverage detected