MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_no_mappers

Method test_no_mappers

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

Source from the content-addressed store, hash-verified

150 eq_(u1, sess.get(User, u2.id))
151
152 def test_no_mappers(self):
153 users = self.tables.users
154
155 self.mapper_registry.map_imperatively(User, users)
156 u1 = User(name="ed")
157 u1_pickled = pickle.dumps(u1, -1)
158
159 clear_mappers()
160
161 assert_raises_message(
162 orm_exc.UnmappedInstanceError,
163 "Cannot deserialize object of type "
164 "<class 'sqlalchemy.testing.pickleable.User'> - no mapper()",
165 pickle.loads,
166 u1_pickled,
167 )
168
169 def test_no_instrumentation(self):
170 users = self.tables.users

Callers

nothing calls this directly

Calls 5

UserClass · 0.90
clear_mappersFunction · 0.90
assert_raises_messageFunction · 0.90
map_imperativelyMethod · 0.80
dumpsMethod · 0.45

Tested by

no test coverage detected