def test_getLastDate(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.getLastDate`.""" gregorian_date = datetime.datetime.strptime( gregorian, USED_DATEFMT).date() + datetime.timedelta(days=1) to_test = Tzolkin.fromDateString(date_str=gregorian, fmt=USED_DATEFMT) assert to_test.getLastDate( start_date=gregorian_date) == lastTzolkin( # nosec tzolkin=tzolkin, starting=gregorian_date)
def test_getLastDateList(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.getLastDateList`.""" gregorian_date = datetime.datetime.strptime( gregorian, USED_DATEFMT).date() - datetime.timedelta(days=1) to_test = Tzolkin.fromDateString(date_str=gregorian, fmt=USED_DATEFMT) tz_list = to_test.getLastDateList(start_date=gregorian_date) good_list = tzolkin2gregorian(tzolkin=tzolkin, start=gregorian_date, num_results=50, forward=False) assert len(tz_list) == 50 # nosec for idx in range(0, len(good_list)): assert tz_list[idx] == good_list[idx] # nosec
def test_getLastDateToday(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.getLastDate`.""" to_test = Tzolkin.fromDateString(date_str=gregorian, fmt=USED_DATEFMT) assert to_test.getLastDate() == lastTzolkin( # nosec tzolkin=tzolkin, starting=datetime.date.today())
def test_fromDateStr(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.fromDateString`.""" to_test = Tzolkin.fromDateString(date_str=gregorian, fmt=USED_DATEFMT) assert to_test.getDayNumber() == tzolkin.number # nosec assert to_test.getDayNameNumber() == tzolkin.name # nosec
def test_print(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.__repr__()`.""" to_test = Tzolkin.fromDateString(date_str=gregorian, fmt=USED_DATEFMT) assert to_test.__repr__() == tzolkin.__repr__() # nosec