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

Improve fr_FR provider postcode #1852

Merged
merged 1 commit into from
May 3, 2023

Conversation

tonial
Copy link
Contributor

@tonial tonial commented Apr 24, 2023

What does this change

Improve postcode for fr_FR address provider

What was wrong

The current provider may generate postcodes for invalid departments (any number starting with 96 is invalid)

How this fixes it

Generate postcode from department codes

NB: I'm not sure how to test this commit : I could check that the generated postcode always match a department, but the test would be flaky before the fix...

faker/providers/address/fr_FR/__init__.py Outdated Show resolved Hide resolved
faker/providers/address/fr_FR/__init__.py Outdated Show resolved Hide resolved
@tonial tonial force-pushed the alaurent/improve_french_postcode branch from a90e0e9 to 4d72728 Compare April 24, 2023 17:02
@tonial tonial requested a review from fcurella April 27, 2023 12:43
@fcurella
Copy link
Collaborator

we could just check that the first 2 characters are a valid department code? Better than nothing :)

@tonial tonial force-pushed the alaurent/improve_french_postcode branch from 4d72728 to 0187102 Compare April 28, 2023 09:45
@tonial
Copy link
Contributor Author

tonial commented Apr 28, 2023

I added the check.
And thanks to it, I noticed I previously made a mistake as if the department code is 2A or 2B, the postcode starts with 20....

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

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

Could you fix the linting issue?

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

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

Could you fix the linting issue?

@tonial tonial force-pushed the alaurent/improve_french_postcode branch from 0187102 to 0eac3af Compare May 2, 2023 14:26
@tonial
Copy link
Contributor Author

tonial commented May 2, 2023

I fixed it :)

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

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

Thank you!

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