def test_festival(self): this1 = pytime.new_year(2015) == datetime.date(2015, 1, 1) self.assertTrue(this1) this2 = pytime.valentine(2014) == datetime.date(2014, 2, 14) self.assertTrue(this2) this3 = pytime.fool(2013) == datetime.date(2013, 4, 1) self.assertTrue(this3) this4 = pytime.christmas(2012) == datetime.date(2012, 12, 25) self.assertTrue(this4) this5 = pytime.christ_eve(2011) == datetime.date(2011, 12, 24) self.assertTrue(this5) this6 = pytime.mother(2010) == datetime.date(2010, 5, 9) self.assertTrue(this6) this7 = pytime.father(2009) == datetime.date(2009, 6, 21) self.assertTrue(this7) this8 = pytime.halloween(2008) == datetime.date(2008, 10, 31) self.assertTrue(this8) this9 = pytime.easter(2007) == datetime.date(2007, 4, 8) self.assertTrue(this9) this10 = pytime.thanks(2006) == datetime.date(2006, 11, 23) self.assertTrue(this10) this11 = pytime.vatertag(2020) == datetime.date(2020, 5, 21) self.assertTrue(this11) this12 = pytime.vatertag(2021) == datetime.date(2021, 5, 13) self.assertTrue(this12) this13 = pytime.vatertag(2025) == datetime.date(2025, 5, 29) self.assertTrue(this13)
def calendar(): holidays = ['Halloween', 'Easter', 'Christmas'] year = int(input("Please enter a year: ")) print("Available holidays:", holidays) # TODO: validate holiday = input("Please enter a holiday: ") if holiday == 'Halloween': print("In", year, "Halloween was on", pytime.halloween(year)) elif holiday == 'Easter': print("In", year, "Easter was on", pytime.easter(year)) elif holiday == 'Christmas': print("In", year, "Christmas was on", pytime.christmas(year))
def test_festival(self): this1 = pytime.new_year(2015) == datetime.date(2015, 1, 1) self.assertTrue(this1) this2 = pytime.valentine(2014) == datetime.date(2014, 2, 14) self.assertTrue(this2) this3 = pytime.fool(2013) == datetime.date(2013, 4, 1) self.assertTrue(this3) this4 = pytime.christmas(2012) == datetime.date(2012, 12, 25) self.assertTrue(this4) this5 = pytime.christ_eve(2011) == datetime.date(2011, 12, 24) self.assertTrue(this5) this6 = pytime.mother(2010) == datetime.date(2010, 5, 9) self.assertTrue(this6) this7 = pytime.father(2009) == datetime.date(2009, 6, 21) self.assertTrue(this7) this8 = pytime.halloween(2008) == datetime.date(2008, 10, 31) self.assertTrue(this8) this9 = pytime.easter(2007) == datetime.date(2007, 4, 8) self.assertTrue(this9) this10 = pytime.thanks(2006) == datetime.date(2006, 11, 23) self.assertTrue(this10)
from pytime import pytime # This is from the documentation # Mother's Day. print(pytime.mother(1977)) # Father's Day. print(pytime.father(1977)) # Easter Sunday. print(pytime.easter(1977))