Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def test_invalid_date(self):
     from argparse import ArgumentTypeError
     with self.assertRaises(ArgumentTypeError):
         scripts.parse_datestring("1900")
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 def test_invalid_date(self):
     from argparse import ArgumentTypeError
     with self.assertRaises(ArgumentTypeError):
         scripts.parse_datestring("1900")
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)