Ejemplo n.º 1
0
    def test_plus(self):
        date_1 = Date('jan 10')
        date_1.microsecond = 1
        date_2 = Date('jan 11')
        date_2.microsecond = 1
        self.assertEqual(date_1 + '1 day', date_2)

        date1 = Date('october 18, 2013 10:04:32 PM')
        date2 = date1 + '10 seconds'
        self.assertEqual(date1.second + 10, date2.second)
Ejemplo n.º 2
0
    def test_adjustment(self):
        d = Date('Jan 1st 2014 at 10 am')
        self.assert_date(d, datetime(2014, 1, 1, 10))

        d.hour = 5
        d.day = 15
        d.month = 4
        d.year = 2013
        d.minute = 40
        d.second = 14
        d.microsecond = 10001
        self.assertEqual(d, datetime(2013, 4, 15, 5, 40, 14, 10001))

        self.assertEqual(str(d.date), '2013-04-15 05:40:14.010001')
Ejemplo n.º 3
0
 def test_minus(self):
     date_1 = Date('jan 10')
     date_1.microsecond = 1
     date_2 = Date('jan 5')
     date_2.microsecond = 1
     self.assertEqual(Date(date_1) - '5 days', date_2)