Commit 62e7808
committed
merge: upstream PR #2383 (en_US county provider) + fixes
Adds US county data (3143 counties across 50 states + DC) to the en_US
address provider, exposing three new methods:
- county() -> random county from all counties
- county_by_state() -> random county, optionally scoped to a state
- county_with_state() -> 'County, State'
Paths rewritten faker/ -> faker2/ for the renamed package.
Fixes applied on top of the upstream patch:
1. counties.py: dropped the stray '"Geographic area name": []' entry, a
leftover CSV header artifact that leaked into COUNTIES_BY_STATE. Its
empty list made county_with_state() raise IndexError whenever that key
was drawn. COUNTIES_BY_STATE now holds exactly 51 keys.
2. __init__.py: made the county_by_state() state argument optional
(Optional[str] = None -> pick a random state), matching the existing
postcode_in_state convention. Required for tests/test_factory.py::
test_documentor, which invokes every provider method with no args.
3. Reformatted with black (line-length 120); flake8 clean.
Tests: 2742 passed, 12 skipped.1 parent d2d9d78 commit 62e7808
2 files changed
Lines changed: 6404 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
447 | 448 | | |
448 | 449 | | |
449 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
450 | 467 | | |
451 | 468 | | |
452 | 469 | | |
| |||
0 commit comments