Closed pengdada00100 closed 3 months ago
The implementation is in https://github.com/joke2k/faker/blob/250fa19baf01aa2289afe44b07225f785cf536c5/faker/providers/address/en_US/__init__.py#L543-L547 Feel free to submit a corresponding PR.
- Faker version: 24.0
- OS:Macos
Call fake.zipcode_in_state('AZ'), the return zipcode not valid AZ zip code
Steps to reproduce
Run code: `from faker import Faker
if name == "main": fake = Faker() f = fake.zipcode_in_state('AZ') print(f)`
get 85800 which not in AZ state
Expected behavior
The zip code should in AZ
Actual behavior
The zipcode not in AZ
@pengdada00100 You can add locale to your code For example:
if __name__ == "__main__":
fake = Faker("en_US") # add locale
f = fake.zipcode_in_state('AZ')
print(f)
I think this issue can be closed. The problem is that not all 5 digits are valid ZIP codes, and faker can't create valid ones without checking them from a database/API.
However, 85775 is Tucson, AZ and 85901 is Show Low, AZ, so the randomly created 85800 is in the correct range for AZ.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Call fake.zipcode_in_state('AZ'), the return zipcode not valid AZ zip code
Steps to reproduce
Run code: `from faker import Faker
if name == "main": fake = Faker() f = fake.zipcode_in_state('AZ') print(f)`
get 85800 which not in AZ state
Expected behavior
The zip code should in AZ
Actual behavior
The zipcode not in AZ