def test_can_encode_datetime(self):
     date_time = datetime.datetime(year=2012, month=1, day=1, hour=1,
                                   minute=1, second=1)
     encoded = util.encode_json_date(date_time)
     self.assertEqual(encoded, "2012-01-01T01:01:01")
 def test_can_encode_date(self):
     date = datetime.date(year=2012, month=1, day=1)
     encoded = util.encode_json_date(date)
     self.assertEqual(encoded, "2012-01-01")
 def test_return_none_if_not_date_or_datetime(self):
     not_a_date = "hello!"
     self.assertEqual(util.encode_json_date(not_a_date), None)