Repository: joke2k/faker
Pull request #1150 (2020-04-05 15:18:05)

Support for UK counties.
### What does this changes

Adds support for UK counties to the GB address locale. 


Patch:
diff --git a/faker/providers/address/en_GB/__init__.py b/faker/providers/address/en_GB/__init__.py
index 9bc758ba..282ac458 100644
--- a/faker/providers/address/en_GB/__init__.py
+++ b/faker/providers/address/en_GB/__init__.py
@@ -26,6 +26,102 @@ class Provider(AddressProvider):
         'side',
         'shire',
     )
+    counties = (
+        'Bedfordshire',
+        'Buckinghamshire',
+        'Cambridgeshire',
+        'Cheshire',
+        'Cleveland',
+        'Cornwall',
+        'Cumbria',
+        'Derbyshire',
+        'Devon',
+        'Dorset',
+        'Durham',
+        'East Sussex',
+        'Essex',
+        'Gloucestershire',
+        'Greater London',
+        'Greater Manchester',
+        'Hampshire',
+        'Hertfordshire',
+        'Kent',
+        'Lancashire',
+        'Leicestershire',
+        'Lincolnshire',
+        'Merseyside',
+        'Norfolk',
+        'North Yorkshire',
+        'Northamptonshire',
+        'Northumberland',
+        'Nottinghamshire',
+        'Oxfordshire',
+        'Shropshire',
+        'Somerset',
+        'South Yorkshire',
+        'Staffordshire',
+        'Suffolk',
+        'Surrey',
+        'Tyne and Wear',
+        'Warwickshire',
+        'West Berkshire',
+        'West Midlands',
+        'West Sussex',
+        'West Yorkshire',
+        'Wiltshire',
+        'Worcestershire',
+        'Flintshire',
+        'Glamorgan',
+        'Merionethshire',
+        'Monmouthshire',
+        'Montgomeryshire',
+        'Pembrokeshire',
+        'Radnorshire',
+        'Anglesey',
+        'Breconshire',
+        'Caernarvonshire',
+        'Cardiganshire',
+        'Carmarthenshire',
+        'Denbighshire',
+        'Aberdeen City',
+        'Aberdeenshire',
+        'Angus',
+        'Argyll and Bute',
+        'City of Edinburgh',
+        'Clackmannanshire',
+        'Dumfries and Galloway',
+        'Dundee City',
+        'East Ayrshire',
+        'East Dunbartonshire',
+        'East Lothian',
+        'East Renfrewshire',
+        'Eilean Siar',
+        'Falkirk',
+        'Fife',
+        'Glasgow City',
+        'Highland',
+        'Inverclyde',
+        'Midlothian',
+        'Moray',
+        'North Ayrshire',
+        'North Lanarkshire',
+        'Orkney Islands',
+        'Perth and Kinross',
+        'Renfrewshire',
+        'Scottish Borders',
+        'Shetland Islands',
+        'South Ayrshire',
+        'South Lanarkshire',
+        'Stirling',
+        'West Dunbartonshire',
+        'West Lothian',
+        'Antrim',
+        'Armagh',
+        'Down',
+        'Fermanagh',
+        'Derry and Londonderry',
+        'Tyrone',
+    )
     building_number_formats = ('#', '##', '###')
     street_suffixes = (
         'alley',
@@ -329,3 +425,6 @@ class Provider(AddressProvider):
 
     def secondary_address(self):
         return self.bothify(self.random_element(self.secondary_address_formats))
+
+    def county(self):
+        return self.random_element(self.counties)
diff --git a/faker/providers/bank/es_ES/__init__.py b/faker/providers/bank/es_ES/__init__.py
new file mode 100644
index 00000000..807d57e4
--- /dev/null
+++ b/faker/providers/bank/es_ES/__init__.py
@@ -0,0 +1,6 @@
+from .. import Provider as BankProvider
+
+
+class Provider(BankProvider):
+    bban_format = '####################'
+    country_code = 'ES'
diff --git a/faker/providers/color/fr_FR/__init__.py b/faker/providers/color/fr_FR/__init__.py
index 261201b1..b46314fc 100644
--- a/faker/providers/color/fr_FR/__init__.py
+++ b/faker/providers/color/fr_FR/__init__.py
@@ -65,7 +65,7 @@ class Provider(ColorProvider):
         ("Beige antique", "#FAEBD7"),
         ("Beige papaye", "#FFEFD5"),
         ("Amande", "#FFEBCD"),
-        ("Bisque", "#ffe4c4"),
+        ("Bisque", "#FFE4C4"),
         ("Beige pêche", "#FFDAB9"),
         ("Beige mocassin", "#FFE4B5"),
         ("Jaune blanc navaro", "#FFDEAD"),
diff --git a/faker/providers/color/hy_AM/__init__.py b/faker/providers/color/hy_AM/__init__.py
index 2dfa2cdb..65fa5cc6 100644
--- a/faker/providers/color/hy_AM/__init__.py
+++ b/faker/providers/color/hy_AM/__init__.py
@@ -37,7 +37,7 @@ class Provider(ColorProvider):
         ("Գունատ փիրուզագույն", "#AFEEEE"),
         ("Գրասենյակային կանաչ", "#008000"),
         ("Դարչնագույն ավազ", "#F4A460"),
-        ("Դարչնագույն", "#964b00"),
+        ("Դարչնագույն", "#964B00"),
         ("Դեղին", "#FFFF00"),
         ("Դեղձի կրեմ", "#FFDAB9"),
         ("Դեղնականաչ", "#9ACD3"),
diff --git a/faker/providers/color/pt_BR/__init__.py b/faker/providers/color/pt_BR/__init__.py
index a3a2d949..593bbb8e 100644
--- a/faker/providers/color/pt_BR/__init__.py
+++ b/faker/providers/color/pt_BR/__init__.py
@@ -50,7 +50,7 @@ class Provider(ColorProvider):
         ("Azul flor de milho", "#6495ED"),
         ("Azul força aérea", "#5D8AA8"),
         ("Azul furtivo", "#1E90FF"),
-        ("Azul manteiga", "#a6aa3e"),
+        ("Azul manteiga", "#A6AA3E"),
         ("Azul marinho", "#120A8F"),
         ("Azul médio", "#0000CD"),
         ("Azul meia-noite", "#191970"),
@@ -152,7 +152,7 @@ class Provider(ColorProvider):
         ("Marrom claro", "#A52A2A"),
         ("Marrom rosado", "#BC8F8F"),
         ("Marrom sela", "#8B4513"),
-        ("Marrom", "#964b00"),
+        ("Marrom", "#964B00"),
         ("Milho Claro", "#FFF8DC"),
         ("Milho", "#FBEC5D"),
         ("Mocassim", "#FFE4B5"),


Test patch:
diff --git a/tests/providers/test_address.py b/tests/providers/test_address.py
index 66114721..e99dfc0d 100644
--- a/tests/providers/test_address.py
+++ b/tests/providers/test_address.py
@@ -337,6 +337,10 @@ class TestEnGB(unittest.TestCase):
         for _ in range(100):
             assert isinstance(parse_uk_postcode(self.fake.postcode()), tuple)
 
+    def test_county(self):
+        county = self.fake.county()
+        assert isinstance(county, str)
+
 
 class TestEnUS(unittest.TestCase):
     """ Tests addresses in the en_US locale """
diff --git a/tests/providers/test_bank.py b/tests/providers/test_bank.py
index a6cc524d..2ed83dee 100644
--- a/tests/providers/test_bank.py
+++ b/tests/providers/test_bank.py
@@ -110,3 +110,19 @@ class TestPtPt(unittest.TestCase):
     def test_iban(self):
         iban = self.fake.iban()
         assert re.match(r"PT\d{21}", iban)
+
+
+class TestEsES(unittest.TestCase):
+    """Tests the bank provider for es_ES locale"""
+
+    def setUp(self):
+        self.fake = Faker('es_ES')
+        Faker.seed(0)
+
+    def test_bban(self):
+        bban = self.fake.bban()
+        assert re.match(r"\d{20}", bban)
+
+    def test_iban(self):
+        iban = self.fake.iban()
+        assert re.match(r"ES\d{22}", iban)