|
|
6a40a12 |
From ad738a8c9f48b3b01535a0cafe03ce7126fa5efc Mon Sep 17 00:00:00 2001
|
|
|
6a40a12 |
From: Stuart Prescott <stuart@debian.org>
|
|
|
6a40a12 |
Date: Thu, 25 Nov 2021 00:00:26 +1100
|
|
|
6a40a12 |
Subject: [PATCH 3/8] Update test for data change: number of subdivisions
|
|
|
6a40a12 |
|
|
|
6a40a12 |
---
|
|
|
6a40a12 |
src/pycountry/tests/test_general.py | 2 +-
|
|
|
6a40a12 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
index ea697ae..d636e34 100644
|
|
|
6a40a12 |
--- a/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
+++ b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
@@ -71,7 +71,7 @@ def test_germany_has_all_attributes():
|
|
|
6a40a12 |
|
|
|
6a40a12 |
|
|
|
6a40a12 |
def test_subdivisions_directly_accessible():
|
|
|
6a40a12 |
- assert len(pycountry.subdivisions) == 4883
|
|
|
6a40a12 |
+ assert len(pycountry.subdivisions) == 5123
|
|
|
6a40a12 |
assert isinstance(list(pycountry.subdivisions)[0], pycountry.db.Data)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
de_st = pycountry.subdivisions.get(code='DE-ST')
|
|
|
6a40a12 |
|
|
|
6a40a12 |
From d80f4757a4f4d1cae67e7cf10ba17dbbf8381382 Mon Sep 17 00:00:00 2001
|
|
|
6a40a12 |
From: Stuart Prescott <stuart@debian.org>
|
|
|
6a40a12 |
Date: Thu, 25 Nov 2021 00:00:56 +1100
|
|
|
6a40a12 |
Subject: [PATCH 4/8] Update test for data change: localisation of division
|
|
|
6a40a12 |
types
|
|
|
6a40a12 |
|
|
|
6a40a12 |
---
|
|
|
6a40a12 |
src/pycountry/tests/test_general.py | 2 +-
|
|
|
6a40a12 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
index d636e34..23b07f7 100644
|
|
|
6a40a12 |
--- a/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
+++ b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
@@ -77,7 +77,7 @@ def test_subdivisions_directly_accessible():
|
|
|
6a40a12 |
de_st = pycountry.subdivisions.get(code='DE-ST')
|
|
|
6a40a12 |
assert de_st.code == u'DE-ST'
|
|
|
6a40a12 |
assert de_st.name == u'Sachsen-Anhalt'
|
|
|
6a40a12 |
- assert de_st.type == u'State'
|
|
|
6a40a12 |
+ assert de_st.type == u'Land'
|
|
|
6a40a12 |
assert de_st.parent is None
|
|
|
6a40a12 |
assert de_st.parent_code is None
|
|
|
6a40a12 |
assert de_st.country is pycountry.countries.get(alpha_2='DE')
|
|
|
6a40a12 |
|
|
|
6a40a12 |
From 976b931dd0fcc82b49f37e59f90b248a73c514f3 Mon Sep 17 00:00:00 2001
|
|
|
6a40a12 |
From: Stuart Prescott <stuart@debian.org>
|
|
|
6a40a12 |
Date: Thu, 25 Nov 2021 00:01:11 +1100
|
|
|
6a40a12 |
Subject: [PATCH 5/8] Update test for data change: inclusion of flag symbols
|
|
|
6a40a12 |
|
|
|
6a40a12 |
---
|
|
|
6a40a12 |
src/pycountry/tests/test_general.py | 1 +
|
|
|
6a40a12 |
1 file changed, 1 insertion(+)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
index 23b07f7..7581f72 100644
|
|
|
6a40a12 |
--- a/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
+++ b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
@@ -164,6 +164,7 @@ def test_removed_countries():
|
|
|
6a40a12 |
def test_repr():
|
|
|
6a40a12 |
assert re.match("Country\\(alpha_2=u?'DE', "
|
|
|
6a40a12 |
"alpha_3=u?'DEU', "
|
|
|
6a40a12 |
+ "flag='..', "
|
|
|
6a40a12 |
"name=u?'Germany', "
|
|
|
6a40a12 |
"numeric=u?'276', "
|
|
|
6a40a12 |
"official_name=u?'Federal Republic of Germany'\\)",
|
|
|
6a40a12 |
|
|
|
6a40a12 |
From f58911f9fc9c5d550b8b8dbb509b70ba578e616e Mon Sep 17 00:00:00 2001
|
|
|
6a40a12 |
From: Stuart Prescott <stuart@debian.org>
|
|
|
6a40a12 |
Date: Thu, 25 Nov 2021 00:12:17 +1100
|
|
|
6a40a12 |
Subject: [PATCH 6/8] Update test for data change: switch test of subdivisions
|
|
|
6a40a12 |
|
|
|
6a40a12 |
Data update means AL data no longer has subdivisions within subdivisions.
|
|
|
6a40a12 |
Switch to FR which does.
|
|
|
6a40a12 |
---
|
|
|
6a40a12 |
src/pycountry/tests/test_general.py | 18 +++++++++---------
|
|
|
6a40a12 |
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
index 7581f72..a6261e0 100644
|
|
|
6a40a12 |
--- a/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
+++ b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
@@ -84,13 +84,13 @@ def test_subdivisions_directly_accessible():
|
|
|
6a40a12 |
|
|
|
6a40a12 |
|
|
|
6a40a12 |
def test_subdivisions_have_subdivision_as_parent():
|
|
|
6a40a12 |
- al_bu = pycountry.subdivisions.get(code='AL-BU')
|
|
|
6a40a12 |
- assert al_bu.code == u'AL-BU'
|
|
|
6a40a12 |
- assert al_bu.name == u'Bulqiz\xeb'
|
|
|
6a40a12 |
- assert al_bu.type == u'District'
|
|
|
6a40a12 |
- assert al_bu.parent_code == u'AL-09'
|
|
|
6a40a12 |
- assert al_bu.parent is pycountry.subdivisions.get(code='AL-09')
|
|
|
6a40a12 |
- assert al_bu.parent.name == u'Dib\xebr'
|
|
|
6a40a12 |
+ fr_01 = pycountry.subdivisions.get(code='FR-01')
|
|
|
6a40a12 |
+ assert fr_01.code == u'FR-01'
|
|
|
6a40a12 |
+ assert fr_01.name == u'Ain'
|
|
|
6a40a12 |
+ assert fr_01.type == u'Metropolitan department'
|
|
|
6a40a12 |
+ assert fr_01.parent_code == u'FR-ARA'
|
|
|
6a40a12 |
+ assert fr_01.parent is pycountry.subdivisions.get(code='FR-ARA')
|
|
|
6a40a12 |
+ assert fr_01.parent.name == u'Auvergne-Rhône-Alpes'
|
|
|
6a40a12 |
|
|
|
6a40a12 |
|
|
|
6a40a12 |
def test_query_subdivisions_of_country():
|
|
|
6a40a12 |
@@ -205,8 +205,8 @@ def test_lookup():
|
|
|
6a40a12 |
assert euro == pycountry.currencies.lookup('euro')
|
|
|
6a40a12 |
latin = pycountry.scripts.get(name='Latin')
|
|
|
6a40a12 |
assert latin == pycountry.scripts.lookup('latn')
|
|
|
6a40a12 |
- al_bu = pycountry.subdivisions.get(code='AL-BU')
|
|
|
6a40a12 |
- assert al_bu == pycountry.subdivisions.lookup('al-bu')
|
|
|
6a40a12 |
+ fr_ara = pycountry.subdivisions.get(code='FR-ARA')
|
|
|
6a40a12 |
+ assert fr_ara == pycountry.subdivisions.lookup('fr-ara')
|
|
|
6a40a12 |
with pytest.raises(LookupError):
|
|
|
6a40a12 |
pycountry.countries.lookup('bogus country')
|
|
|
6a40a12 |
with pytest.raises(LookupError):
|
|
|
6a40a12 |
|
|
|
6a40a12 |
From 882f16b7bb8d4273d1d4444d83142e59022a90ef Mon Sep 17 00:00:00 2001
|
|
|
6a40a12 |
From: Stuart Prescott <stuart@debian.org>
|
|
|
6a40a12 |
Date: Thu, 25 Nov 2021 00:23:11 +1100
|
|
|
6a40a12 |
Subject: [PATCH 7/8] Update test for data change: switch test of fuzzy search
|
|
|
6a40a12 |
'England'
|
|
|
6a40a12 |
|
|
|
6a40a12 |
The names 'England' and 'England and Wales' no longer appear in the data setso
|
|
|
6a40a12 |
update the test to use NL data with similar properties.
|
|
|
6a40a12 |
---
|
|
|
6a40a12 |
src/pycountry/tests/test_general.py | 14 +++++++-------
|
|
|
6a40a12 |
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
index a6261e0..ed28b38 100644
|
|
|
6a40a12 |
--- a/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
+++ b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
@@ -17,16 +17,16 @@ def test_country_list():
|
|
|
6a40a12 |
|
|
|
6a40a12 |
|
|
|
6a40a12 |
def test_country_fuzzy_search():
|
|
|
6a40a12 |
- results = pycountry.countries.search_fuzzy(u'England')
|
|
|
6a40a12 |
+ results = pycountry.countries.search_fuzzy(u'Overijssel')
|
|
|
6a40a12 |
assert len(results) == 1
|
|
|
6a40a12 |
- assert results[0] == pycountry.countries.get(alpha_2='GB')
|
|
|
6a40a12 |
+ assert results[0] == pycountry.countries.get(alpha_2='NL')
|
|
|
6a40a12 |
|
|
|
6a40a12 |
- # Match alternative names exactly and thus GB ends up with Wales
|
|
|
6a40a12 |
- # before Australia.
|
|
|
6a40a12 |
- results = pycountry.countries.search_fuzzy(u'Wales')
|
|
|
6a40a12 |
+ # Match alternative names exactly and thus NL ends up with
|
|
|
6a40a12 |
+ # "Sint Maarten" before SX with "Sint Maarten (Dutch part)"
|
|
|
6a40a12 |
+ results = pycountry.countries.search_fuzzy(u'Sint Maarten')
|
|
|
6a40a12 |
assert len(results) == 2
|
|
|
6a40a12 |
- assert results[0] == pycountry.countries.get(alpha_2='GB')
|
|
|
6a40a12 |
- assert results[1] == pycountry.countries.get(alpha_2='AU')
|
|
|
6a40a12 |
+ assert results[0] == pycountry.countries.get(alpha_2='NL')
|
|
|
6a40a12 |
+ assert results[1] == pycountry.countries.get(alpha_2='SX')
|
|
|
6a40a12 |
|
|
|
6a40a12 |
# Match with accents removed, first a country with a partial match in the
|
|
|
6a40a12 |
# country name, then a country with multiple subdivision partial matches,
|
|
|
6a40a12 |
|
|
|
6a40a12 |
From 64732f5073ef19610727a83c4139cb615779f5bc Mon Sep 17 00:00:00 2001
|
|
|
6a40a12 |
From: Stuart Prescott <stuart@debian.org>
|
|
|
6a40a12 |
Date: Thu, 25 Nov 2021 00:23:37 +1100
|
|
|
6a40a12 |
Subject: [PATCH 8/8] Update test for data change: add more fuzzy matches to
|
|
|
6a40a12 |
'New'
|
|
|
6a40a12 |
|
|
|
6a40a12 |
---
|
|
|
6a40a12 |
src/pycountry/tests/test_general.py | 4 +++-
|
|
|
6a40a12 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
6a40a12 |
|
|
|
6a40a12 |
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
index ed28b38..75b339d 100644
|
|
|
6a40a12 |
--- a/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
+++ b/src/pycountry/tests/test_general.py
|
|
|
6a40a12 |
@@ -47,7 +47,9 @@ def test_country_fuzzy_search():
|
|
|
6a40a12 |
assert results[4] == pycountry.countries.get(alpha_2='US')
|
|
|
6a40a12 |
assert results[5] == pycountry.countries.get(alpha_2='CA')
|
|
|
6a40a12 |
assert results[6] == pycountry.countries.get(alpha_2='AU')
|
|
|
6a40a12 |
- assert results[7] == pycountry.countries.get(alpha_2='MH')
|
|
|
6a40a12 |
+ assert results[7] == pycountry.countries.get(alpha_2='BS')
|
|
|
6a40a12 |
+ assert results[8] == pycountry.countries.get(alpha_2='TW')
|
|
|
6a40a12 |
+ assert results[9] == pycountry.countries.get(alpha_2='MH')
|
|
|
6a40a12 |
|
|
|
6a40a12 |
# bug #34, likely about capitalization that was broken
|
|
|
6a40a12 |
results = pycountry.countries.search_fuzzy(u'united states of america')
|