(self)
| 503 | eq_(f.b, 12) |
| 504 | |
| 505 | def test_deferred_pickleable(self): |
| 506 | data = {"a": "this is a", "b": 12} |
| 507 | |
| 508 | def loader(state, keys, passive): |
| 509 | for k in keys: |
| 510 | state.dict[k] = data[k] |
| 511 | return attributes.ATTR_WAS_SET |
| 512 | |
| 513 | instrumentation.register_class(MyTest) |
| 514 | manager = attributes.manager_of_class(MyTest) |
| 515 | manager.expired_attribute_loader = loader |
| 516 | _register_attribute(MyTest, "a", uselist=False, useobject=False) |
| 517 | _register_attribute(MyTest, "b", uselist=False, useobject=False) |
| 518 | |
| 519 | m = MyTest() |
| 520 | attributes.instance_state(m)._expire( |
| 521 | attributes.instance_dict(m), set() |
| 522 | ) |
| 523 | assert "a" not in m.__dict__ |
| 524 | m2 = pickle.loads(pickle.dumps(m)) |
| 525 | assert "a" not in m2.__dict__ |
| 526 | eq_(m2.a, "this is a") |
| 527 | eq_(m2.b, 12) |
| 528 | |
| 529 | def test_list(self): |
| 530 | class User: |
nothing calls this directly
no test coverage detected