def test_set_subclass_with_data(self):
     obj = SetSubclass([1, 2, 3])
     data = ListSubclass()
     data.extend([1, 2, 3])
     obj.data = data
     flattened = self.pickler.flatten(obj)
     restored = self.unpickler.restore(flattened)
     self.assertEqual(type(restored.data), ListSubclass)
     self.assertEqual(restored.data, data)
Ejemplo n.º 2
0
 def test_set_subclass_with_data(self):
     obj = SetSubclass([1, 2, 3])
     data = ListSubclass()
     data.extend([1, 2, 3])
     obj.data = data
     flattened = self.pickler.flatten(obj)
     restored = self.unpickler.restore(flattened)
     self.assertEqual(type(restored.data), ListSubclass)
     self.assertEqual(restored.data, data)
 def test_list_subclass(self):
     obj = ListSubclass()
     obj.extend([1, 2, 3])
     flattened = self.pickler.flatten(obj)
     self.assertTrue(tags.OBJECT in flattened)
     self.assertTrue(tags.SEQ in flattened)
     self.assertEqual(len(flattened[tags.SEQ]), 3)
     for v in obj:
         self.assertTrue(v in flattened[tags.SEQ])
     restored = self.unpickler.restore(flattened)
     self.assertEqual(type(restored), ListSubclass)
     self.assertEqual(restored, obj)
Ejemplo n.º 4
0
 def test_list_subclass(self):
     obj = ListSubclass()
     obj.extend([1, 2, 3])
     flattened = self.pickler.flatten(obj)
     self.assertTrue(tags.OBJECT in flattened)
     self.assertTrue(tags.SEQ in flattened)
     self.assertEqual(len(flattened[tags.SEQ]), 3)
     for v in obj:
         self.assertTrue(v in flattened[tags.SEQ])
     restored = self.unpickler.restore(flattened)
     self.assertEqual(type(restored), ListSubclass)
     self.assertEqual(restored, obj)