def test_deserializing_corrupted_raises_exception(self):
     with self.assertRaises(serialization.InvalidData):
         serialization.deserialize("ie")
     with self.assertRaises(serialization.InvalidData):
         serialization.deserialize("100:a")
     with self.assertRaises(serialization.InvalidData):
         serialization.deserialize("blah")
 def test_deserializing_str(self):
     d = serialization.deserialize("5:hello")
     self.assertTrue(d == "hello")
 def test_deserializing_int(self):
     d = serialization.deserialize("i3e")
     self.assertTrue(d == 3)
     d = serialization.deserialize("i102e")
     self.assertTrue(d == 102)
 def test_deserializing_str_returns_str(self):
     d = serialization.deserialize("5:hello")
     self.assertTrue(isinstance(d, str))
 def test_deserializing_int_returns_int(self):
     d = serialization.deserialize("i3e")
     self.assertTrue(isinstance(d, int))