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

testNextMonth fails on February 29th #282

Open
FelixSchwarz opened this issue Jun 9, 2022 · 0 comments
Open

testNextMonth fails on February 29th #282

FelixSchwarz opened this issue Jun 9, 2022 · 0 comments

Comments

@FelixSchwarz
Copy link

testNextMonth fails on February 29th - it returns a date two years later instead of one (e.g. 2022-02-28 instead of 2021-02-28 with a base date of 2020-02-29).

This test reproduces the issue:

def testNextMonthLeapYear(self):
    s = datetime.datetime(2020, 2, 29, self.hr, self.mn, self.sec)
    t = self.cal.inc(s, year=1)
    start = s.timetuple()
    target = t.timetuple()

    self.assertEqual(_tr(self.cal.parse('next February 28', start)),
                     _tr((target, pdtContext(pdtContext.ACU_MONTH | pdtContext.ACU_DAY))))

Output

AssertionError: Tuples differ: ((2022, 2, 28, 8, 21, 0, 0, 0, 0), pdtContext([47 chars]DAY)) != ((2021, 2, 28, 8, 21, 0, 0, 0, 0), pdtContext([47 chars]DAY))

First differing element 0:
(2022, 2, 28, 8, 21, 0, 0, 0, 0)
(2021, 2, 28, 8, 21, 0, 0, 0, 0)

- ((2022, 2, 28, 8, 21, 0, 0, 0, 0),
?        ---

+ ((2021, 2, 28, 8, 21, 0, 0, 0, 0),
?      +++

   pdtContext(accuracy=pdtContext.ACU_MONTH | pdtContext.ACU_DAY))

Initially reported by @hroncok in https://bugzilla.redhat.com/show_bug.cgi?id=1808449

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