def test_TimeSerializer_deserialize(self): serializer = base.TimeSerializer() self.assertEqual(serializer.deserialize("00:00:00Z"), datetime.time(0, 0, 0)) self.assertEqual(serializer.deserialize("18:33:12Z"), datetime.time(18, 33, 12)) self.assertRaises(ValueError, serializer.deserialize, "25:33:12")
def test_TimeSerializer_serialize(self): serializer = base.TimeSerializer() self.assertEqual( serializer.serialize(datetime.time(0, 0, 0, 1)), "00:00:00Z") self.assertEqual( serializer.serialize(datetime.time(8, 33, 12, 34)), "08:33:12Z")