Repository: joke2k/faker
Pull request #984 (2019-07-30 11:01:14)

Added nationalities for locale pt_PT. Tests are also provided
### What does this changes
It adds nationalities in portuguese
Tests are also provided

Brief summary of the changes
It adds nationalities in portuguese
Tests are also provided

### What was wrong
Nothing, it is just missing this piece of data



fcurella: Thank you! ✨ 

Patch:
diff --git a/faker/providers/geo/pt_PT/__init__.py b/faker/providers/geo/pt_PT/__init__.py
new file mode 100644
index 00000000..7415c5cb
--- /dev/null
+++ b/faker/providers/geo/pt_PT/__init__.py
@@ -0,0 +1,30 @@
+# coding=utf-8
+
+from __future__ import unicode_literals
+from .. import Provider as GeoProvider
+
+
+class Provider(GeoProvider):
+
+    nationalities = (
+        "Afegã", "Albanesa", "Arménia", "Angolana", "Argentina", "Austríaca", "Australiana", "Azerbaijã", "Belga",
+        "Bulgara", "Boliviana", "Brasileira", "Bielorussa", "Canadiana", "Congolesa (República Democrática do Congo)",
+        "Congolesa (República do Congo)", "Suíça", "Marfinense", "Chilena", "Chinesa", "Colombiana", "Costa-Riquenha",
+        "Cubana", "Cabo-verdiana", "Cipriota", "Checa", "Alemã", "Dinamarquesa", "Dominicana", "Argelina",
+        "Equatoriana", "Estónia", "Egípcia", "Espanhola", "Etíope", "Finlândesa", "Francesa", "Grega",
+        "Guineense (Bissau)", "Croata", "Húngara", "Indonésia", "Irlandesa", "Israelita", "Indiana", "Iraquiana",
+        "Iraniana", "Islandesa", "Italiana", "Jamaicana", "Japonesa", "Queniana", "Coreana", "Libanesa", "Lituana",
+        "Luxemburguesa", "Letã", "Marroquina", "Moldava", "Birmanesa", "Maltesa", "Mexicana", "Moçambicana",
+        "Nigeriana", "Holandesa", "Norueguesa", "Nepalesa", "Neozelandesa", "Peruana", "Filipina", "Paquistanesa",
+        "Polaca", "Portuguesa", "Paraguaia", "Romena", "Russa", "Ruandesa", "Sudanesa", "Sueca", "Eslovena", "Eslovaca",
+        "Senegalesa", "Somali", "Santomense", "Salvadorenha", "Tailandesa", "Tunisina", "Turca", "Ucraniana",
+        "Britânica", "Americana", "Uruguaia", "Venezuelana", "Vietnamita", "Sul-Africana", "Sérvia", "Andorrenha",
+        "Bósnia", "Camaronesa", "Georgiana", "Ganesa", "Gambiana", "Hondurenha", "Haitiana", "Cazaque", "Libanesa ",
+        "Monegasca", "Maliana", "Mongol", "Mauritana", "Malaia", "Panamiana", "Saudita", "Singapurense", "Togolesa",
+    )
+
+    def nationality(self):
+        """
+        :example 'Portuguesa'
+        """
+        return self.random_element(self.nationalities)


Test patch:
diff --git a/tests/providers/test_geo.py b/tests/providers/test_geo.py
index eb4b2fa3..5b152eda 100644
--- a/tests/providers/test_geo.py
+++ b/tests/providers/test_geo.py
@@ -5,8 +5,10 @@ from __future__ import unicode_literals
 import re
 import unittest
 from decimal import Decimal
+from six import string_types
 
 from faker import Faker
+from faker.providers.geo.pt_PT import Provider as PtPtProvider
 
 
 class TestGlobal(unittest.TestCase):
@@ -93,3 +95,14 @@ class TestDeAT(unittest.TestCase):
     def test_local_longitude(self):
         local_longitude = self.factory.local_longitude()
         assert re.match(r"1[1-5]\.\d+", str(local_longitude))
+
+
+class TestPtPT(unittest.TestCase):
+
+    def setUp(self):
+        self.factory = Faker('pt_PT')
+
+    def test_nationality(self):
+        nationality = self.factory.nationality()
+        assert isinstance(nationality, string_types)
+        assert nationality in PtPtProvider.nationalities