Skip to content

Commit

Permalink
Add geo for pl_PL (#2044)
Browse files Browse the repository at this point in the history
  • Loading branch information
george0st committed May 8, 2024
1 parent 0512242 commit c3c1c0f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
29 changes: 29 additions & 0 deletions faker/providers/geo/pl_PL/__init__.py
@@ -0,0 +1,29 @@
from .. import Provider as GeoProvider


class Provider(GeoProvider):
# Source:
# https://latitude.to/map/pl/poland/cities/
land_coords = (
("52.22977", "21.01178", "Warsaw", "PL", "Europe/Warsaw"),
("51.75", "19.46667", "Łódź", "PL", "Europe/Warsaw"),
("50.06143", "19.93658", "Krakow", "PL", "Europe/Warsaw"),
("51.1", "17.03333", "Wrocław", "PL", "Europe/Warsaw"),
("52.40692", "16.92993", "Poznań", "PL", "Europe/Warsaw"),
("54.35205", "18.64637", "Gdańsk", "PL", "Europe/Warsaw"),
("53.42894", "14.55302", "Szczecin", "PL", "Europe/Warsaw"),
("53.1235", "18.00762", "Bydgoszcz", "PL", "Europe/Warsaw"),
("51.25", "22.56667", "Lublin", "PL", "Europe/Warsaw"),
("50.25841", "19.02754", "Katowice", "PL", "Europe/Warsaw"),
("53.13333", "23.16433", "Białystok", "PL", "Europe/Warsaw"),
("54.51889", "18.53188", "Gdynia", "PL", "Europe/Warsaw"),
("50.79646", "19.12409", "Częstochowa", "PL", "Europe/Warsaw"),
("50.28682", "19.10385", "Sosnowiec", "PL", "Europe/Warsaw"),
("51.40253", "21.14714", "Radom", "PL", "Europe/Warsaw"),
("52.1934", "21.03487", "Mokotów", "PL", "Europe/Warsaw"),
("53.01375", "18.59814", "Toruń", "PL", "Europe/Warsaw"),
("50.87033", "20.62752", "Kielce", "PL", "Europe/Warsaw"),
("50.29761", "18.67658", "Gliwice", "PL", "Europe/Warsaw"),
("50.32492", "18.78576", "Zabrze", "PL", "Europe/Warsaw"),
("50.34802", "18.93282", "Bytom", "PL", "Europe/Warsaw"),
)
16 changes: 16 additions & 0 deletions tests/providers/test_geo.py
Expand Up @@ -129,6 +129,22 @@ def test_local_longitude(self):
local_longitude = self.fake.local_longitude()
assert re.match(r"1[1-5]\.\d+", str(local_longitude))

class TestPlPl(unittest.TestCase):

Check failure on line 132 in tests/providers/test_geo.py

View workflow job for this annotation

GitHub Actions / flake8

expected 2 blank lines, found 1
def setUp(self):
self.fake = Faker("pl_PL")
Faker.seed(0)

def test_location_on_land(self):
loc = self.fake.location_on_land()
assert isinstance(loc, tuple)
assert len(loc) == 5
assert Decimal(loc[0]) # Should be able to cast first two elements of tuple to Decimal
assert Decimal(loc[1])
assert isinstance(loc[2], str) # Place is a string
assert isinstance(loc[3], str) # Country code is a string
assert len(loc[3]) == 2 # Country code is two letters
assert isinstance(loc[4], str) # Timezone is a string


class TestPtPT(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit c3c1c0f

Please sign in to comment.