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

switzerland: add rules for all cantons #497

Closed
wants to merge 1 commit into from
Closed

switzerland: add rules for all cantons #497

wants to merge 1 commit into from

Conversation

brutasse
Copy link
Contributor

@brutasse brutasse commented May 4, 2020

Information based on https://en.wikipedia.org/wiki/Public_holidays_in_Switzerland

For the days that are shared across multiple cantons, I built a base Switzerland calendar with opt-out and opt-in days for cantons to set.

Raising this in non-final state in case it may already be useful to others, I'll complete the checklist later on once I'm done moving to Luzern which is one of the best cantons from a public holiday PoV :)

  • Tests with a significant number of years to be tested for your calendar.
  • Docstrings for the Calendar class and specific methods.
  • Use the workalendar.registry_tools.iso_register decorator to register your new calendar using ISO codes (optional).
  • Calendar country / label added to the README.rst file.
  • Changelog amended with a mention like: "Added <country> by @pseudo (#)". Note Please do NOT change the version number here. It's the project maintainers' duty.

@brunobord
Copy link
Member

nice try, but your tests are failing apparently ;o)

@brunobord
Copy link
Member

@brutasse do you need help to fix this branch?

@brutasse
Copy link
Contributor Author

@brunobord I do lack a bit of time to refactor the tests (the ones based on the base switzerland calandar are a bit too simplistic) and for proper coverage I'd need 2-3 years for all cantons… mostly mechanical, but time-consuming. Maintainers can push to my branch if they're up for it, otherwise it'll take a while :)

@brunobord
Copy link
Member

Ok, I think I'll take your branch over when I can.
Don't worry about that, it'll be fine.
Thanks for the update!

@brunobord
Copy link
Member

@brutasse Currently working on Switzerland, based on your work... I've got a question: does that make sense to have a Switzerland calendar without it being a Canton? Would anybody use a "generic" Switzerland calendar, do you think?

@brutasse
Copy link
Contributor Author

@brunobord a generic Switzeland calendar could be provided but it'd make sense for it to only contain the federal holiday, that is, 1st of august - even though 3 more days are common to all cantons.

In the context of Workalendar, a user could think it'd be a good "average" Switzerland calendar so I'm not sure it would be super valuable in practice. How does it work for other federated states?

@brunobord
Copy link
Member

Well, there's a test suite for the USA, because historically, there was only this one for the US. Then it expanded as tests for each State and sub-variants (counties, cities, etc). But there are a lot more Federal days in common for the USA (a bit less than 10, IIRC), so it made sense to have a "USACalendarTest" and mixins for specifics.

Starting off what you've just said, I think I'll leave the Switzerland class like this: it'll be tested through the Cantons test suites, but would only be available if someday you want to build your own calendar for your yet-to-be-named Canton, or else. The coverage results would tell me if all cases are already covered.

@brunobord
Copy link
Member

@brutasse
Copy link
Contributor Author

brutasse commented Jun 2, 2020

🎉 thanks a lot @brunobord!

@brutasse brutasse deleted the feature/all-ch-cantons branch June 2, 2020 10:12
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.

None yet

2 participants