feat: Add es_PE locale with providers #2303
Open
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.
A new directory was created at faker/providers/es_PE/ to house the following new provider modules:
Provider Implementation
address: Generates realistic Peruvian addresses, including departments, cities, and correctly formatted postal codes.
automotive: Creates Peruvian vehicle license plates, supporting both the modern (LLL-NNN) and previous (LL-NNNN) formats.
bank: Provides Peruvian banking data, including 20-digit Interbank Account Codes (CCI) and names of major local banks.
company: Generates Peruvian company names with appropriate legal suffixes (e.g., S.A.C., E.I.R.L.).
internet: Localizes internet data, ensuring generated email addresses and domains use the .pe top-level domain.
person: Provides common Peruvian first names and last names, including some of indigenous origin, by extending the base Spanish provider.
phone_number: Generates valid phone numbers with formats for mobile phones and landlines (both for Lima and other provinces).
ssn: Creates Peruvian national identification numbers, including the 8-digit DNI (national identity document) and the 11-digit RUC (taxpayer registry number) with a valid check-digit calculation.
color, currency, date_time, job: These providers were added by inheriting directly from the existing es_ES locale, as their data is largely identical.
Testing
tests/providers/test_es_PE.py: A new test file was created to validate all the custom es_PE providers. It includes specific tests for the formats and logic of addresses, license plates, bank accounts, phone numbers, DNI, and RUC, ensuring the generated data is accurate and conforms to Peruvian standards. It also includes basic checks for the cloned providers.
closes #2301