Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Test holidays for multiple countries is failing for Pytest 3.12 #1599

Open
MaiBe-ctrl opened this issue Jun 25, 2024 · 0 comments
Open

Comments

@MaiBe-ctrl
Copy link
Collaborator

MaiBe-ctrl commented Jun 25, 2024

Prerequisites
Python 3.12

Describe the bug
We are getting the following error in our pipeline test: FAILED tests/test_event_utils.py::test_multiple_countries - AssertionError: assert 'Erster Weihnachtstag' not in {'Christi Himmelfahrt', 'Christi Himmelfahrt; Erster Mai', 'Christmas Day', 'Columbus Day', 'Erster Mai', 'Erster Weihnachtstag', ...}
This is mainly due to the fact that we are getting the holidays names for the US in English and the ones for Germany in German. As a result, we would have duplicated holidays having names in different languages.

Expected behavior
We would expect at the end to get a unique list of holidays(no matter what the language is). The assertion shouldn't fail.

Additional context

This only happens for the specific case of python 3.12. We tried solving this issue by creating a holiday name as a combination of both its occurrences and make sure to have at the end the holiday appearing only one time in the list.

We should find a cleaner way to do it without adding more complexity to the code.

Add any other context about the problem here.

Pytest to re-add to tests/test_event_utils.py

def test_multiple_countries():
    # test if multiple countries are added
    df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
    m = NeuralProphet(
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
        learning_rate=LR,
    )
    m.add_country_holidays(country_name=["US", "Germany"])
    m.fit(df, freq="D")
    m.predict(df)
    # get the name of holidays and compare that no holiday is repeated
    holiday_names = m.model.config_holidays.holiday_names
    assert "Independence Day" in holiday_names
    assert "Christmas Day" in holiday_names
    assert "Erster Weihnachtstag" not in holiday_names
    assert "Neujahr" not in holiday_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant