Esempio n. 1
0
 def test_lib_cdate_Julianday(self):
     for m in range(3, 6):
         for d in range(10, 20):
             j = cdate.julianDay(2020, m, d)
             jy, jm, jd = cdate.FromJulian(j)
             self.assertEqual(
                 (2020, m, d), (jy, jm, jd),
                 msg='Julian/Gregorian round-trip failed for 2020-%i-%i' %
                 (m, d))
Esempio n. 2
0
 def test_lib_cdate_Dayofweek(self):
     # this also validates cdate.julianDay, since Date.day_of_week depends on it
     for m in range(3, 6):
         for d in range(10, 20):
             realwd = datetime.date(2020, m, d).weekday()
             testwd = cdate.Date(2020, m, d).day_of_week
             self.assertEqual(
                 realwd,
                 testwd,
                 msg="Expected weekday to be %i for date 2020-%i-%i, got %i"
                 % (realwd, m, d, testwd))
Esempio n. 3
0
 def test_lib_cdate_DateCtor(self):
     cdate.Date(2014, 1, 31)
Esempio n. 4
0
 def test_lib_cdate_IsleapFalse(self):
     l2 = cdate.isleap(2013)
     self.assertFalse(l2, msg='Expected a non leap year')
Esempio n. 5
0
 def test_lib_cdate_NowCtor(self):
     cdate.now()
Esempio n. 6
0
 def test_lib_cdate_IsleapTrue(self):
     l1 = cdate.isleap(2012)
     self.assertTrue(l1, msg='Expected a leap year')
Esempio n. 7
0
 def test_lib_cdate_Dayofweek(self):
     jd = cdate.julianDay(2014, 1, 10)
     dw = cdate.dayOfWeek(jd)
     self.assertTrue(dw == 4, msg='Expected "4" assuming Monday is 1, got %s' % dw)
Esempio n. 8
0
    def test_lib_cdate_Julianday(self):
        bd = cdate.Date(2014, 1, 10)
        jd = cdate.julianDay(bd.year, bd.month, bd.day)

        self.assertTrue(jd == bd.julian,
                        msg='Expected them to be equal')
Esempio n. 9
0
 def test_lib_cdate_IsleapFalse(self):
     l2 = cdate.isleap(2013)
     self.assertFalse(l2, msg='Expected a non leap year')
Esempio n. 10
0
 def test_lib_cdate_IsleapTrue(self):
     l1 = cdate.isleap(2012)
     self.assertTrue(l1, msg='Expected a leap year')
Esempio n. 11
0
 def test_lib_cdate_NowCtor(self):
     cdate.now()