def test_fromToday() -> None: """Test `Tzolkin.fromToday`.""" assert ( # nosec Tzolkin.fromToday().getDayName() == Tzolkin.fromDate( date=datetime.date.today()).getDayName()) assert ( # nosec Tzolkin.fromToday().getDayNumber() == Tzolkin.fromDate( date=datetime.date.today()).getDayNumber())
def test_getDayDiff(gregorian: str, tzolkin: TzolkinDate, days: int) -> None: """Test `Tzolkin.getDayDiff`.""" gregorian_date = datetime.datetime.strptime(gregorian, USED_DATEFMT).date() tzolkin_start = Tzolkin.fromDate(date=gregorian_date) assert tzolkin_start.getTzolkinDate().number == tzolkin.number # nosec assert tzolkin_start.getTzolkinDate().name == tzolkin.name # nosec tzolkin_add = Tzolkin.fromDate(date=gregorian_date).addTimedelta( datetime.timedelta(days=days)) assert tzolkin_start.getDayDiff(other=tzolkin_add) == days # nosec
def test_fromDateConst(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin`.""" gregorian_date = datetime.datetime.strptime(gregorian, USED_DATEFMT).date() to_test = Tzolkin.fromDate(gregorian_date) another = Tzolkin(number=tzolkin.number, name_str=day_names[tzolkin.name]) assert to_test.getDayNumber() == another.getDayNumber() # nosec assert to_test.getDayNameNumber() == another.getDayNameNumber() # nosec
def test_getTzolkinYearDay(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.getTzolkinYearDay`.""" gregorian_date = datetime.datetime.strptime(gregorian, USED_DATEFMT).date() to_test = Tzolkin.fromDate(gregorian_date) assert to_test.getTzolkinYearDay() == getTzolkinDay(tzolkin) # nosec
def test_getTzolkinDate(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.getTzolkinDate`.""" gregorian_date = datetime.datetime.strptime(gregorian, USED_DATEFMT).date() to_test = Tzolkin.fromDate(gregorian_date) assert to_test.getTzolkinDate().number == tzolkin.number # nosec assert to_test.getTzolkinDate().name == tzolkin.name # nosec