def test_year_zero(self): assert gregorian.to_jd(1, 1, 1) == 1.0 + gregorian.to_jd(0, 12, 31) assert julian.to_jd(1, 1, 1) == 1.0 + julian.to_jd(0, 12, 31) assert julian.from_jd(julian.to_jd(1, 1, 1) - 1) == (0, 12, 31) self.assertEqual(gregorian.from_jd(gregorian.to_jd(1, 1, 1) - 1), (0, 12, 31))
def test_hebrew(self): self.assertEqual(self.jd, hebrew.to_jd(*hebrew.from_jd(self.jd))) self.reflexive(hebrew.from_jd, hebrew.to_jd) # Anno Mundi am = hebrew.to_jd(1, hebrew.TISHRI, 1) self.assertEqual(julian.from_jd(am), (-3760, 10, 7))
def test_dublin_dc(self): self.assertEqual(dublin.from_gregorian(1900, 1, 1), 0.5) self.assertEqual(dublin.to_gregorian(1), (1900, 1, 1)) self.assertEqual(dublin.to_jd(0), 2415020.0) self.assertEqual( dublin.to_jd(dublin.from_jd(self.c)), gregorian.to_jd(*dublin.to_gregorian(dublin.from_gregorian(*self.c_greg))) ) self.assertEqual(dublin.to_gregorian(dublin.from_jd(1737936)), gregorian.from_jd(1737936)) self.assertEqual(dublin.to_julian(dublin.from_jd(1737936)), julian.from_jd(1737936))
def test_from_julian(self): self.assertEqual(self.jd, julian.to_jd(*julian.from_jd(self.jd))) self.assertEqual(julian.from_jd(self.c), (1492, 10, 12)) self.assertEqual(julian.from_jd(2400000.5), (1858, 11, 5)) self.assertEqual(julian.from_jd(2399830.5), (1858, 5, 19))