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