def test_class_reference(self): """This test ensures that users can store references to classes. """ obj = Thing("object-with-class-reference") # reference the 'Thing' class (not an instance of the class) obj.classref = Thing flattened = self.pickler.flatten(obj) self.assertEqual(flattened["classref"], {tags.TYPE: "samples.Thing"}) inflated = self.unpickler.restore(flattened) self.assertEqual(inflated.classref, Thing)
def test_class_reference(self): """This test ensures that users can store references to classes. """ obj = Thing('object-with-class-reference') # reference the 'Thing' class (not an instance of the class) obj.classref = Thing flattened = self.pickler.flatten(obj) self.assertEqual(flattened['classref'], { tags.TYPE: 'samples.Thing', }) inflated = self.unpickler.restore(flattened) self.assertEqual(inflated.classref, Thing)