MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_state_info_pickle

Method test_state_info_pickle

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

Source from the content-addressed store, hash-verified

463 eq_(u1, u2)
464
465 def test_state_info_pickle(self):
466 users = self.tables.users
467 self.mapper_registry.map_imperatively(User, users)
468
469 u1 = User(id=1, name="ed")
470
471 sa.inspect(u1).info["some_key"] = "value"
472
473 state_dict = sa.inspect(u1).__getstate__()
474
475 state = sa_state.InstanceState.__new__(sa_state.InstanceState)
476 state.__setstate__(state_dict)
477
478 u2 = state.obj()
479 eq_(sa.inspect(u2).info["some_key"], "value")
480
481 @testing.combinations(
482 lambda User: sa.orm.joinedload(User.addresses),

Callers

nothing calls this directly

Calls 6

UserClass · 0.90
eq_Function · 0.90
map_imperativelyMethod · 0.80
__getstate__Method · 0.45
__new__Method · 0.45
__setstate__Method · 0.45

Tested by

no test coverage detected