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

CzechRepublic: 2023-07-01 .. 2023-08-01 reports 20 working days while there are 19 #753

Open
vlcinsky opened this issue Aug 1, 2023 · 0 comments

Comments

@vlcinsky
Copy link

vlcinsky commented Aug 1, 2023

Hi there
In July 2023 in Czechia we have two days of holidays during ordinary working days.
Following test shows, that for calculating working days during the first working week and during the whole month, it returns wrong number of working days.

Hint: the holidays are on Wednesday and Thursday, so there is only one working day left till weekend. In some countries (like Spain) they have "bridge holiday" for situations like that, if the gap is just one day, it is considered a holiday too.
But for Czechia this is not the case.

Following file (name it test_it.py) could be run using pytest.

import pytest
from datetime import date

@pytest.fixture
def cal():
    from workalendar.europe import CzechRepublic
    return CzechRepublic()

@pytest.mark.parametrize("start_day,end_day,expected_working_days", [
    (date(2023, 7,3), date(2023,7,4), 1), # passing
    (date(2023, 7,3), date(2023,7,9), 3), # failing
    (date(2023, 7,1), date(2023,8,1), 19) # failing
    ])
def test_it(cal, start_day,end_day,expected_working_days):
    working_days = cal.get_working_days_delta(start_day, end_day)
    assert working_days == expected_working_days

When run, it reports:

============================================================================================ test session starts ============================================================================================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/javl/sandbox/try_workalendar
collected 3 items                                                                                                                                                                                           

tests/test_it.py .FF                                                                                                                                                                                  [100%]

================================================================================================= FAILURES ==================================================================================================
______________________________________________________________________________________ test_it[start_day1-end_day1-3] _______________________________________________________________________________________

cal = <workalendar.europe.czech_republic.CzechRepublic object at 0x7f75603d0150>, start_day = datetime.date(2023, 7, 3), end_day = datetime.date(2023, 7, 9), expected_working_days = 3

    @pytest.mark.parametrize("start_day,end_day,expected_working_days", [
        (date(2023, 7,3), date(2023,7,4), 1), # passing
        (date(2023, 7,3), date(2023,7,9), 3), # failing
        (date(2023, 7,1), date(2023,8,1), 19) # failing
        ])
    def test_it(cal, start_day,end_day,expected_working_days):
        working_days = cal.get_working_days_delta(start_day, end_day)
>       assert working_days == expected_working_days
E       assert 2 == 3

tests/test_it.py:16: AssertionError
______________________________________________________________________________________ test_it[start_day2-end_day2-19] ______________________________________________________________________________________

cal = <workalendar.europe.czech_republic.CzechRepublic object at 0x7f75603d0810>, start_day = datetime.date(2023, 7, 1), end_day = datetime.date(2023, 8, 1), expected_working_days = 19

    @pytest.mark.parametrize("start_day,end_day,expected_working_days", [
        (date(2023, 7,3), date(2023,7,4), 1), # passing
        (date(2023, 7,3), date(2023,7,9), 3), # failing
        (date(2023, 7,1), date(2023,8,1), 19) # failing
        ])
    def test_it(cal, start_day,end_day,expected_working_days):
        working_days = cal.get_working_days_delta(start_day, end_day)
>       assert working_days == expected_working_days
E       assert 20 == 19

tests/test_it.py:16: AssertionError
========================================================================================== short test summary info ==========================================================================================
FAILED tests/test_it.py::test_it[start_day1-end_day1-3] - assert 2 == 3
FAILED tests/test_it.py::test_it[start_day2-end_day2-19] - assert 20 == 19
======================================================================================== 2 failed, 1 passed in 0.10s ========================================================================================

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