예제 #1
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')
예제 #2
0
    def test_date_adjustment(self):
        d = Date("Jan 1st 2014 at 10 am")
        self.assertEqual(d.year, 2014)
        self.assertEqual(d.month, 1)
        self.assertEqual(d.day, 1)
        self.assertEqual(d.hour, 10)
        self.assertEqual(d.minute, 0)
        self.assertEqual(d.second, 0)

        d.hour = 5
        d.day = 15
        d.month = 4
        d.year = 2013
        d.minute = 40
        d.second = 14

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

        self.assertEqual(str(d.date), "2013-04-15 05:40:14")
예제 #3
0
    def test_date_adjustment(self):
        d = Date("Jan 1st 2014 at 10 am")
        self.assertEqual(d.year, 2014)
        self.assertEqual(d.month, 1)
        self.assertEqual(d.day, 1)
        self.assertEqual(d.hour, 10)
        self.assertEqual(d.minute, 0)
        self.assertEqual(d.second, 0)

        d.hour = 5
        d.day = 15
        d.month = 4
        d.year = 2013
        d.minute = 40
        d.second = 14

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

        self.assertEqual(str(d.date), "2013-04-15 05:40:14")