class PermanentStorageTests(testcase.TestCase):
    def setUp(self):
        super(PermanentStorageTests, self).setUp()
        self.storage = PermanentStorage()
        self.storage.insert(1)
        self.storage.insert(3)
        self.storage.insert(5)

    def test_serialization(self):
        self.assertEqual(set(self.storage.serialize()), set((1, 3, 5)))

    def test_deserialization(self):
        self.assertEqual(
            PermanentStorage.deserialize(self.storage.serialize())._data,
            set((1, 3, 5)))

    def test_insert(self):
        self.storage.insert(4)
        self.assertEqual(self.storage._data, set((1, 3, 4, 5)))

    def test_insert_duplicate(self):
        self.assertRaises(DuplicateInsertError, self.storage.insert, 3)

    def test_is_contain(self):
        self.assertTrue(1 in self.storage)
        self.assertFalse(2 in self.storage)
        self.assertTrue(3 in self.storage)
        self.assertFalse(4 in self.storage)
class PermanentStorageTests(testcase.TestCase):
    def setUp(self):
        super(PermanentStorageTests, self).setUp()
        self.storage = PermanentStorage()
        self.storage.insert(1)
        self.storage.insert(3)
        self.storage.insert(5)

    def test_serialization(self):
        self.assertEqual(set(self.storage.serialize()), set((1, 3, 5)))

    def test_deserialization(self):
        self.assertEqual(PermanentStorage.deserialize(self.storage.serialize())._data, set((1, 3, 5)))

    def test_insert(self):
        self.storage.insert(4)
        self.assertEqual(self.storage._data, set((1, 3, 4, 5)))

    def test_insert_duplicate(self):
        self.assertRaises(DuplicateInsertError, self.storage.insert, 3)

    def test_is_contain(self):
        self.assertTrue(1 in self.storage)
        self.assertFalse(2 in self.storage)
        self.assertTrue(3 in self.storage)
        self.assertFalse(4 in self.storage)
 def test_deserialization(self):
     self.assertEqual(
         PermanentStorage.deserialize(self.storage.serialize())._data,
         set((1, 3, 5)))
 def setUp(self):
     super(PermanentStorageTests, self).setUp()
     self.storage = PermanentStorage()
     self.storage.insert(1)
     self.storage.insert(3)
     self.storage.insert(5)
 def test_deserialization(self):
     self.assertEqual(PermanentStorage.deserialize(self.storage.serialize())._data, set((1, 3, 5)))
 def setUp(self):
     super(PermanentStorageTests, self).setUp()
     self.storage = PermanentStorage()
     self.storage.insert(1)
     self.storage.insert(3)
     self.storage.insert(5)