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)
Esempio 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)
Esempio 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)
Esempio n. 5
0
 def test_is_sequence_subclass_subclass(self):
     self.assertTrue(is_sequence_subclass(ListSubclass()))
Esempio n. 6
0
 def test_subclass(self):
     self.assertTrue(is_collection_subclass(ListSubclass()))