Skip to content

Commit

Permalink
improve Canada (CA) fallback, with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freyfogle committed Nov 15, 2024
1 parent 723422f commit bd55f65
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conf/countries/worldwide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ CA:
{{{attention}}}
{{{house}}}
{{#first}} {{{house_number}}} {{{road}}} || {{{suburb}}} {{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{village}}} || {{{hamlet}}} || {{{county}}} || {{{state_district}}} {{/first}}, {{#first}} {{{state_code}}} || {{{state}}} {{/first}} {{{postcode}}}
{{#first}} {{{city}}} || {{{town}}} || {{{village}}} || {{{hamlet}}} || {{{county}}} || {{{state_district}}} || {{{region}}}{{/first}}, {{#first}} {{{state}}} || {{{state_code}}} {{/first}} {{{postcode}}}
{{{country}}}
postformat_replace:
# fix the postcode to make it \w\w\w \w\w\w
Expand Down
15 changes: 13 additions & 2 deletions testcases/countries/ca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ components:
state: Ontario
state_code: "ON"
expected: |
London, ON
London, Ontario
Canada
---
# London treated as county
Expand Down Expand Up @@ -91,7 +91,7 @@ components:
county: Springfield
state: Manitoba
expected: |
Springfield, MB
Springfield, Manitoba
Canada
---
# 43.60242, -79.80113
Expand Down Expand Up @@ -125,3 +125,14 @@ expected: |
12345 Av Demars
St-Hyancinth, J2T 3T5
Canada
---
# region
components:
country: Canada
country_code: ca
region: Greater Edmonton
state: Alberta
state_code: AB
expected: |
Greater Edmonton, Alberta
Canada

0 comments on commit bd55f65

Please sign in to comment.