def test_utcnow(self): self.assertIsInstance(utcnow(), datetime) date1 = get_date(datetime.now(tz=utc)) date2 = utcnow() self.assertEqual(date1.year, date2.year) self.assertEqual(date1.month, date2.month) self.assertEqual(date1.day, date2.day) self.assertEqual(date1.hour, date2.hour) self.assertEqual(date1.minute, date2.minute) self.assertEqual(date1.second, date2.second)
def test_get_date(self): self.assertIsInstance(get_date('2012-12-12'), datetime) self.assertIsInstance(get_date(datetime.now()), datetime) self.assertIsNone(get_date(None))