not much of a 'test', but illustrate how to remove instance-level state before pickling.
(self)
| 867 | ) |
| 868 | |
| 869 | def test_rebuild_state(self): |
| 870 | """not much of a 'test', but illustrate how to |
| 871 | remove instance-level state before pickling. |
| 872 | |
| 873 | """ |
| 874 | |
| 875 | users = self.tables.users |
| 876 | |
| 877 | self.mapper_registry.map_imperatively(User, users) |
| 878 | |
| 879 | u1 = User() |
| 880 | attributes.manager_of_class(User).teardown_instance(u1) |
| 881 | assert not u1.__dict__ |
| 882 | u2 = pickle.loads(pickle.dumps(u1)) |
| 883 | attributes.manager_of_class(User).setup_instance(u2) |
| 884 | assert attributes.instance_state(u2) |
nothing calls this directly
no test coverage detected