def test_just_time(self): from datetime import datetime actual = scripts.parse_datestring("01:00:00") now = datetime.now() self.assertEquals(actual.year, now.year) self.assertEquals(actual.month, now.month) self.assertEquals(actual.day, now.day)
def test_fixed_date_with_time__seconds_not_included(self): from datetime import datetime actual = scripts.parse_datestring("1/1/2000 01:00") expected = datetime(year=2000, month=1, day=1, hour=1, minute=1, second=0) self.assertEquals(actual, expected)
def test_invalid_date(self): from argparse import ArgumentTypeError with self.assertRaises(ArgumentTypeError): scripts.parse_datestring("1900")
def test_fixed_date_with_time__seconds_not_included(self): from datetime import datetime actual = scripts.parse_datestring("1/1/2000 01:00") expected = datetime(year=2000, month=1, day=1, hour=1, minute=1, second=0) self.assertEqual(actual, expected)
def test_fixed_date_without_time(self): from datetime import date actual = scripts.parse_datestring("1/1/2000").date() expected = date(year=2000, month=1, day=2) self.assertEqual(actual, expected)
def test_just_time(self): actual = scripts.parse_datestring("01:00:00") now = datetime.now() self.assertEquals(actual.year, now.year) self.assertEquals(actual.month, now.month) self.assertEquals(actual.day, now.day)
def test_fixed_date_without_time(self): from datetime import date actual = scripts.parse_datestring("1/1/2000").date() expected = date(year=2000, month=1, day=2) self.assertEquals(actual, expected)