-
Notifications
You must be signed in to change notification settings - Fork 3
Fix typos and improve int input handling #126
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
base: main
Are you sure you want to change the base?
Conversation
- Fix typo: registert_i_foretaksregisteret -> registrert_i_foretaksregisteret - Fix typo: trangsopplosning -> tvangsopplosning - Fix OrganisasjonsnummerValidator to accept int input by converting to str first - Fix incorrect docstring in get_roller method
| organisasjonsnummer: Organisasjonsnummer, | ||
| ) -> list[RolleGruppe]: | ||
| """Get :class:`Enhet` given an organization number.""" | ||
| """Get roles for an entity given an organization number.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion might be more useful, but to be consistent with the other docstrings change to:
| """Get roles for an entity given an organization number.""" | |
| """Get a list of :class:`RolleGruppe` given an organization number.""" |
src/brreg/enhetsregisteret/_types.py
Outdated
| Organisasjonsnummer = Annotated[ | ||
| str, | ||
| BeforeValidator(lambda v: v.replace(" ", "")), | ||
| BeforeValidator(lambda v: str(v).replace(" ", "")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the org number has been converted to an int, it will have lost leading zeros, so we should left-pad with zeros until we have nine digits.
| BeforeValidator(lambda v: str(v).replace(" ", "")), | |
| BeforeValidator(lambda v: str(v).replace(" ", "").zfill(9)), |
The support for converting ints to org numbers deserves some test coverage.
PR_DESCRIPTION.md
Outdated
| @@ -0,0 +1,47 @@ | |||
| # Fix typos and improve int input handling for OrganisasjonsnummerValidator | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this file.
- Update get_roller docstring to use :class:\RolleGruppe\ for consistency - Add .zfill(9) to handle leading zeros when int is converted to org number - Add test coverage for int-to-org-number conversion - Remove PR_DESCRIPTION.md
Fix typo: registert_i_foretaksregisteret -> registrert_i_foretaksregisteret
Fix typo: trangsopplosning -> tvangsopplosning
Fix OrganisasjonsnummerValidator to accept int input by converting to str first
Fix incorrect docstring in get_roller method