Exemplo n.º 1
0
 def test_gregorian_date_from_julian_day(self):
     jd = 0
     self.assertRaises(ValueError, alg_c.get_gregorian_date_from_julian_day, jd)
     self.assertRaises(ValueError, alg_p.get_gregorian_date_from_julian_day, jd)
     while jd < 365 * 200:
         jd += 1
         self.assertEqual(
             alg_c.get_gregorian_date_from_julian_day(jd),
             alg_p.get_gregorian_date_from_julian_day(jd)
         )
Exemplo n.º 2
0
 def test_gregorian_date_from_julian_day(self):
     jd = 0
     self.assertRaises(ValueError, alg_c.get_gregorian_date_from_julian_day,
                       jd)
     self.assertRaises(ValueError, alg_p.get_gregorian_date_from_julian_day,
                       jd)
     while jd < 365 * 200:
         jd += 1
         self.assertEqual(alg_c.get_gregorian_date_from_julian_day(jd),
                          alg_p.get_gregorian_date_from_julian_day(jd))
Exemplo n.º 3
0
    def test_jalali_date_from_gregorian_date(self):
        jd = 0
        while jd < 365 * 200:
            jd += 1
            cd = alg_c.get_gregorian_date_from_julian_day(jd)
            pd = alg_p.get_gregorian_date_from_julian_day(jd)

            c = alg_c.get_jalali_date_from_gregorian_date(*cd)
            p = alg_p.get_jalali_date_from_gregorian_date(*pd)

            self.assertEqual(c, p, 'jd: %s c: %s py: %s cdate: %s pydate: %s' % (jd, c, p, cd, pd))
Exemplo n.º 4
0
    def test_jalali_date_from_gregorian_date(self):
        jd = 0
        while jd < 365 * 200:
            jd += 1
            cd = alg_c.get_gregorian_date_from_julian_day(jd)
            pd = alg_p.get_gregorian_date_from_julian_day(jd)

            c = alg_c.get_jalali_date_from_gregorian_date(*cd)
            p = alg_p.get_jalali_date_from_gregorian_date(*pd)

            self.assertEqual(
                c, p, 'jd: %s c: %s py: %s cdate: %s pydate: %s' %
                (jd, c, p, cd, pd))