def test_french_republican_schematic_continuous_from_gregorian(self): self.assertEqual((16, 1, 1), fr.from_gregorian(1807, 9, 24, method='continuous')) for f, g in year_starts: self.assertEqual(f, fr.from_gregorian(*g, method=4)) for f, g in continuous: self.assertEqual(f, fr.from_gregorian(*g, method=4))
def test_french_republican(self): assert self.jd == fr.to_jd(*fr.from_jd(self.jd)) assert fr.from_gregorian(2014, 6, 14) == (222, 9, 26) assert (2014, 6, 14) == fr.to_gregorian(222, 9, 26) assert (3, 13, 6) == fr.from_gregorian(1795, 9, 22) for jd in range(2378822, 2488395, 2000): self.assertEqual(jd + 0.5, gregorian.to_jd(*gregorian.from_jd(jd + 0.5)))
def test_french_republican_schematic_romme(self): self.assertEqual(self.gregoriandate, fr.to_gregorian( *fr.from_gregorian(*self.gregoriandate, method=100), method=100)) self.assertEqual(self.jd, fr.to_jd(*fr.from_jd(self.jd, method='romme'), method=100)) self.assertEqual(self.x, fr.to_jd(*fr.from_jd(self.x, method=100), method=100)) assert self.j == fr.to_jd(*fr.from_jd(self.j, method=100), method=100)
def to_date_string(self): """Given the quote, returns the date in a printable, french format. If the date is during the french revolutionary calendar usage time, display it thusly. Else, display it in the more classical way.""" if self.date >= REV_CALENDAR_BEGIN and self.date <= REV_CALENDAR_END: # During revolutionary calendar : return the date in this format d = french_republican.from_gregorian(self.date.year, self.date.month, self.date.day) return french_republican.format(*d) else: return old_date_to_string(self.date)
def test_french_republican_famous_dates(self): self.assertEqual(gregorian.to_jd(1793, 9, 22), fr.to_jd(2, 1, 1)) # 9 Thermidor II self.assertEqual(gregorian.to_jd(1794, 7, 27), fr.to_jd(2, 11, 9)) # 18 Brumaire An VIII assert gregorian.to_jd(1799, 11, 9) == fr.to_jd(8, 2, 18) assert fr.to_jd(2, 9, 22) == gregorian.to_jd(1794, 6, 10) assert fr.to_jd(4, 1, 13) == gregorian.to_jd(1795, 10, 5) assert fr.to_gregorian(5, 12, 18) == (1797, 9, 4) assert fr.to_jd(6, 8, 22) == gregorian.to_jd(1798, 5, 11) assert (2, 9, 22) == fr.from_gregorian(1794, 6, 10) assert (4, 1, 13) == fr.from_gregorian(1795, 10, 5) assert (5, 12, 18) == fr.from_gregorian(1797, 9, 4) assert (6, 8, 22) == fr.from_gregorian(1798, 5, 11) # Coup of 30 Prairial VII self.assertEqual(fr.to_gregorian(7, 9, 30), (1799, 6, 18))
def test_french_republican_start_of_years_from_gregorian_equinoctal(self): for f, g in year_starts: self.assertEqual(f, fr.from_gregorian(*g))
def test_french_republican_schematic_madler_from_gregorian(self): for f, g in year_starts: self.assertEqual(g, fr.to_gregorian(*f, method=128)) for f, g in madler: self.assertEqual(f, fr.from_gregorian(*g, method=128))
def test_french_republican_leap_days_from_gregorian_romme(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g, method=100))
def test_french_republican_leap_days_from_gregorian_equinoctal(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g))
def test_french_republican_leap_days_from_gregorian_madler(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g, method='madler'))
def test_french_republican_leap_days_from_gregorian_continuous(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g, method=4))
def test_french_republican_start_of_years_from_gregorian_equinoctal(self): for f, g in year_starts: self.assertEqual(f, fr.from_gregorian(*g))
def test_french_republican_leap_days_from_gregorian_madler(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g, method='madler'))
def test_french_republican_schematic_romme_from_gregorian(self): for f, g in year_starts: self.assertEqual(f, fr.from_gregorian(*g, method='romme')) for f, g in romme: self.assertEqual(f, fr.from_gregorian(*g, method=100))
def test_french_republican_leap_days_from_gregorian_equinoctal(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g))
def test_french_republican_schematic_madler_from_gregorian(self): for f, g in year_starts: self.assertEqual(g, fr.to_gregorian(*f, method=128)) for f, g in madler: self.assertEqual(f, fr.from_gregorian(*g, method=128))
def test_french_republican_leap_days_from_gregorian_continuous(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g, method=4))
def test_french_republican_leap_days_from_gregorian_romme(self): for f, g in leaps: self.assertEqual(f, fr.from_gregorian(*g, method=100))
def test_french_republican_schematic_romme_from_gregorian(self): for f, g in year_starts: self.assertEqual(f, fr.from_gregorian(*g, method='romme')) for f, g in romme: self.assertEqual(f, fr.from_gregorian(*g, method=100))