Exemplo n.º 1
0
 def test_DateSerializer_deserialize(self):
     serializer = base.DateSerializer()
     self.assertEqual(serializer.deserialize("1900-01-01"),
                      datetime.date(1900, 1, 1))
     self.assertEqual(serializer.deserialize("2014-09-12"),
                      datetime.date(2014, 9, 12))
     self.assertRaises(ValueError, serializer.deserialize, "2014-02-30")
Exemplo n.º 2
0
 def test_DateSerializer_serialize(self):
     serializer = base.DateSerializer()
     self.assertEqual(
         serializer.serialize(datetime.date(1900, 1, 1)), "1900-01-01")
     self.assertEqual(
         serializer.serialize(datetime.date(2014, 9, 12)), "2014-09-12")