French social security numbers - corsican codes#2373
Open
dancergraham wants to merge 9 commits into
Open
Conversation
Agent-Logs-Url: https://github.com/dancergraham/faker/sessions/c37c463b-b410-460b-9b66-8da985992016 Co-authored-by: dancergraham <32717635+dancergraham@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dancergraham/faker/sessions/c37c463b-b410-460b-9b66-8da985992016 Co-authored-by: dancergraham <32717635+dancergraham@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds support for Corsican French SSN (NIR) department codes (2A / 2B) in the fr_FR SSN provider, including the required checksum normalization, and updates tests to accept alphanumeric SSNs.
Changes:
- Extend
fr_FRSSN generation to allow Corsican department codes (2A,2B). - Update checksum calculation to normalize
2A -> 19and2B -> 18before mod-97. - Strengthen
fr_FRSSN tests to validate the new format and deterministic Corsica generation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
faker/providers/ssn/fr_FR/__init__.py |
Adds 2A/2B departments and updates checksum computation to handle letters. |
tests/providers/test_ssn.py |
Updates SSN regex expectations and adds targeted tests for Corsican codes and checksum. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Removed redundant test case for SSN generation.
Agent-Logs-Url: https://github.com/dancergraham/faker/sessions/7f311d17-2963-4f94-80fc-ef157fd48d1f Co-authored-by: dancergraham <32717635+dancergraham@users.noreply.github.com>
…cksum-calculation Support int input for French SSN checksum
Contributor
Author
|
Hi @fcurella anything I can do to make this PR easier to check / approve / reject ? This fixes a genuine hole in the current implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change
Adds corsican department codes to the list of possible values for the creation of French social security numbers
What was wrong
The current implementation ommits the possibility of corsican department codes - the only ones which include letters (A or B). This may (correctly) break the code of some users of faker if they currently wrongly assume that French Social Security numbers are all digits.
How this fixes it
Adds the missing codes and updates the checksum calculation.
Fixes #2372
AI Assistance Disclosure (REQUIRED)
I used GPT5.4 via GitHub Copilot, giving it specific and detailed instructions on what changes to make - I have fully reviewed, verified and simplified the output.
Checklist
make lint