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

Clarify DST Warsaw test #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanpurkhiser
Copy link
Contributor

I've added comments to each of the test cases to clarify what they're testing.

I'm not completely sure that the hourly DST crossover test is actually correct here, I've called that out in a XXX comment

Comment on lines +847 to +857
# First iteration at 02:00 UTC+2:00
self.assertEqual(
iter.get_next(datetime),
tz.localize(datetime(2017, 10, 29, 2, 0), is_dst=True),
)

# Second iteration at 02:00 UTC+1:00
self.assertEqual(
iter.get_next(datetime),
tz.localize(datetime(2017, 10, 29, 2, 0), is_dst=False),
)
Copy link
Contributor Author

@evanpurkhiser evanpurkhiser Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as this test before

start_date = tz.localize(datetime(2017, 10, 29))
self.assertEqual(
    val.replace(tzinfo=None),
    tz.localize(datetime(2017, 10, 29, 2)).replace(tzinfo=None),
)
local_date = tz.localize(datetime(2017, 10, 29, 2))
val = croniter("0 * * * *", local_date).get_next(datetime)
self.assertEqual(val, tz.localize(datetime(2017, 10, 29, 3)))

But I think should be more clear what the test is by using the is_dst parameter of pytz.

This is also the test that I think may not be what we actually want. Wouldn't we want this to tick back to 01:00 without DST? So we would actually tick 01:00 twice. Right now we're ticking 02:00 twice, which seems wrong

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

Successfully merging this pull request may close these issues.

1 participant