def testIsLeapYear(): print("isLeapYear") t().checkExpect(ValidDate("11/11/2000").isLeapYear(), True) t().checkExpect(ValidDate("11/11/5890").isLeapYear(), False) t().checkExpect(ValidDate("11/11/1111").isLeapYear(), False) t().checkExpect(ValidDate("11/11/2004").isLeapYear(), True) t().checkExpect(ValidDate("11/11/1900").isLeapYear(), False) print()
def testDateNumbers(): print("dateNumbers") t().checkExpect(ValidDate("11/11/2000").dateNumbers(), True) t().checkExpect(ValidDate("11/11/asdd").dateNumbers(), False) t().checkExpect(ValidDate("as/11/2000").dateNumbers(), False) t().checkExpect(ValidDate("11/ad/2000").dateNumbers(), False) print()
def testSlashes(): print("slashes") t().checkExpect(ValidDate("11112000").slashes(), False) t().checkExpect(ValidDate("111/11/200").slashes(), False) t().checkExpect(ValidDate("11/11/2000").slashes(), True) t().checkExpect(ValidDate("11/11").slashes(), False) print()
def testLeapCentury(): print("leapCentury") t().checkExpect(ValidDate("11/11/2100").leapCentury(), False) t().checkExpect(ValidDate("11/11/0021").leapCentury(), False) t().checkExpect(ValidDate("11/11/0201").leapCentury(), False) t().checkExpect(ValidDate("11/11/2001").leapCentury(), False) t().checkExpect(ValidDate("11/11/2000").leapCentury(), True) t().checkExpect(ValidDate("11/11/1900").leapCentury(), False) print()
def testmonth31day(): print("month31day") t().checkExpect(ValidDate("11/02/2000").month31day(), False) t().checkExpect(ValidDate("11/04/2000").month31day(), False) t().checkExpect(ValidDate("11/01/2000").month31day(), True) t().checkExpect(ValidDate("11/03/2000").month31day(), True) t().checkExpect(ValidDate("11/05/2000").month31day(), True) t().checkExpect(ValidDate("11/07/2000").month31day(), True) t().checkExpect(ValidDate("11/08/2000").month31day(), True) t().checkExpect(ValidDate("11/10/2000").month31day(), True) t().checkExpect(ValidDate("11/12/2000").month31day(), True) print()
def testIsValidMonth(): print("isValidMonth") t().checkExpect(ValidDate("11/11/2000").isValidMonth(), True) t().checkExpect(ValidDate("11/14/2000").isValidMonth(), False) t().checkExpect(ValidDate("11/13/2000").isValidMonth(), False) t().checkExpect(ValidDate("11/01/2000").isValidMonth(), True) t().checkExpect(ValidDate("11/12/2000").isValidMonth(), True) t().checkExpect(ValidDate("11/00/2000").isValidMonth(), False) print()
def testIsValidDay(): print("isValidDay") t().checkExpect(ValidDate("31/01/2000").isValidDay(), True) t().checkExpect(ValidDate("30/10/2000").isValidDay(), True) t().checkExpect(ValidDate("32/07/2000").isValidDay(), False) t().checkExpect(ValidDate("00/03/2000").isValidDay(), False) t().checkExpect(ValidDate("01/03/2000").isValidDay(), True) t().checkExpect(ValidDate("09/03/2000").isValidDay(), True) t().checkExpect(ValidDate("30/04/2000").isValidDay(), True) t().checkExpect(ValidDate("31/04/2000").isValidDay(), False) t().checkExpect(ValidDate("32/04/2000").isValidDay(), False) t().checkExpect(ValidDate("29/04/2000").isValidDay(), True) t().checkExpect(ValidDate("29/02/2000").isValidDay(), True) t().checkExpect(ValidDate("30/02/2000").isValidDay(), False) t().checkExpect(ValidDate("28/02/2000").isValidDay(), True) t().checkExpect(ValidDate("28/02/1900").isValidDay(), True) t().checkExpect(ValidDate("30/02/1900").isValidDay(), False) t().checkExpect(ValidDate("29/02/1900").isValidDay(), False) print()
def testHasDateFormat(): print("hasDateFormat") t().checkExpect(ValidDate("11/11/2000").hasDateFormat(), True) t().checkExpect(ValidDate("11/sd/2000").hasDateFormat(), True) t().checkExpect(ValidDate("11/00/ashd").hasDateFormat(), True) t().checkExpect(ValidDate("as/00/2000").hasDateFormat(), True) t().checkExpect(ValidDate("11/11").hasDateFormat(), False) t().checkExpect(ValidDate("00/00/0000").hasDateFormat(), True) t().checkExpect(ValidDate("11/11/2000").hasDateFormat(), True) t().checkExpect(ValidDate("11112000").hasDateFormat(), False) print()
def testIsValidDate(): print("isValidDate") t().checkExpect(ValidDate("11/11/2000").isValidDate(), True) print()