def test_from_jd(self): self.assertTrue(legal_date(*from_jd(2375479.5))) assert legal_date(*from_jd(2376479.5)) assert legal_date(*from_jd(2378479.5)) assert legal_date(*from_jd(2379479.5)) with self.assertRaises(ValueError): from_jd(EPOCH - 0.5)
def test_from_jd(self): self.assertTrue(legal_date(*from_jd(2375479.5))) assert legal_date(*from_jd(2376479.5)) assert legal_date(*from_jd(2378479.5)) assert legal_date(*from_jd(2379479.5)) with self.assertRaises(ValueError): from_jd(EPOCH - 0.5)
def test_reflexive_jd2(self): assert len(from_jd(2375479.5)) == 3 self.assertEqual(to_jd(*from_jd(2375479.5)), 2375479.5) self.assertEqual(to_jd(*from_jd(2376479.5)), 2376479.5) self.assertEqual(to_jd(*from_jd(2378479.5)), 2378479.5) self.assertEqual(to_jd(*from_jd(2379479.5)), 2379479.5)
def test_reflexive_jd(self): self.assertEqual(from_jd(to_jd(1, 1, 1)), (1, 1, 1)) self.assertEqual(from_jd(to_jd(4, 1, 1)), (4, 1, 1)) self.assertEqual(from_jd(to_jd(4, 14, 1)), (4, 14, 1)) self.assertEqual(from_jd(to_jd(4, 14, 2)), (4, 14, 2)) self.assertEqual(from_jd(to_jd(10, 1, 1)), (10, 1, 1)) self.assertEqual(from_jd(to_jd(12, 1, 1)), (12, 1, 1)) self.assertEqual(from_jd(to_jd(13, 1, 1)), (13, 1, 1)) self.assertEqual(from_jd(to_jd(13, 1, 2)), (13, 1, 2)) self.assertEqual(from_jd(to_jd(13, 1, 3)), (13, 1, 3)) self.assertEqual(from_jd(to_jd(13, 1, 5)), (13, 1, 5)) self.assertEqual(from_jd(to_jd(13, 1, 7)), (13, 1, 7)) self.assertEqual(from_jd(to_jd(13, 1, 14)), (13, 1, 14)) self.assertEqual(from_jd(to_jd(13, 1, 28)), (13, 1, 28)) self.assertEqual(from_jd(to_jd(13, 2, 28)), (13, 2, 28)) self.assertEqual(from_jd(to_jd(13, 6, 1)), (13, 6, 1)) self.assertEqual(from_jd(to_jd(14, 1, 1)), (14, 1, 1)) self.assertEqual(from_jd(to_jd(16, 1, 1)), (16, 1, 1)) self.assertEqual(from_jd(to_jd(50, 1, 1)), (50, 1, 1)) self.assertEqual(from_jd(to_jd(99, 1, 1)), (99, 1, 1)) self.assertEqual(from_jd(to_jd(100, 1, 1)), (100, 1, 1)) self.assertEqual(from_jd(to_jd(100, 13, 25)), (100, 13, 25)) self.assertEqual(from_jd(to_jd(120, 13, 25)), (120, 13, 25)) self.assertEqual(from_jd(to_jd(50, 13, 25)), (50, 13, 25)) self.assertEqual(from_jd(to_jd(200, 1, 5)), (200, 1, 5)) self.assertEqual(from_jd(to_jd(250, 14, 1)), (250, 14, 1))
def test_epoch(self): self.assertEqual(to_jd(1, 1, 1), EPOCH) self.assertEqual(to_jd(1, 1, 2), EPOCH + 1) self.assertEqual(to_jd(2, 1, 1), EPOCH + 365.0) self.assertEqual(from_jd(EPOCH), (1, 1, 1))
def test_reflexive_jd2(self): assert len(from_jd(2375479.5)) == 3 self.assertEqual(to_jd(*from_jd(2375479.5)), 2375479.5) self.assertEqual(to_jd(*from_jd(2376479.5)), 2376479.5) self.assertEqual(to_jd(*from_jd(2378479.5)), 2378479.5) self.assertEqual(to_jd(*from_jd(2379479.5)), 2379479.5)
def test_reflexive_jd(self): self.assertEqual(from_jd(to_jd(1, 1, 1)), (1, 1, 1)) self.assertEqual(from_jd(to_jd(4, 1, 1)), (4, 1, 1)) self.assertEqual(from_jd(to_jd(4, 14, 1)), (4, 14, 1)) self.assertEqual(from_jd(to_jd(4, 14, 2)), (4, 14, 2)) self.assertEqual(from_jd(to_jd(10, 1, 1)), (10, 1, 1)) self.assertEqual(from_jd(to_jd(12, 1, 1)), (12, 1, 1)) self.assertEqual(from_jd(to_jd(13, 1, 1)), (13, 1, 1)) self.assertEqual(from_jd(to_jd(13, 1, 2)), (13, 1, 2)) self.assertEqual(from_jd(to_jd(13, 1, 3)), (13, 1, 3)) self.assertEqual(from_jd(to_jd(13, 1, 5)), (13, 1, 5)) self.assertEqual(from_jd(to_jd(13, 1, 7)), (13, 1, 7)) self.assertEqual(from_jd(to_jd(13, 1, 14)), (13, 1, 14)) self.assertEqual(from_jd(to_jd(13, 1, 28)), (13, 1, 28)) self.assertEqual(from_jd(to_jd(13, 2, 28)), (13, 2, 28)) self.assertEqual(from_jd(to_jd(13, 6, 1)), (13, 6, 1)) self.assertEqual(from_jd(to_jd(14, 1, 1)), (14, 1, 1)) self.assertEqual(from_jd(to_jd(16, 1, 1)), (16, 1, 1)) self.assertEqual(from_jd(to_jd(50, 1, 1)), (50, 1, 1)) self.assertEqual(from_jd(to_jd(99, 1, 1)), (99, 1, 1)) self.assertEqual(from_jd(to_jd(100, 1, 1)), (100, 1, 1)) self.assertEqual(from_jd(to_jd(100, 13, 25)), (100, 13, 25)) self.assertEqual(from_jd(to_jd(120, 13, 25)), (120, 13, 25)) self.assertEqual(from_jd(to_jd(50, 13, 25)), (50, 13, 25)) self.assertEqual(from_jd(to_jd(200, 1, 5)), (200, 1, 5)) self.assertEqual(from_jd(to_jd(250, 14, 1)), (250, 14, 1))
def test_epoch(self): self.assertEqual(to_jd(1, 1, 1), EPOCH) self.assertEqual(to_jd(1, 1, 2), EPOCH + 1) self.assertEqual(to_jd(2, 1, 1), EPOCH + 365.0) self.assertEqual(from_jd(EPOCH), (1, 1, 1))