Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add geo for cs_CZ #1938

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions faker/providers/geo/cs_CZ/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from .. import Provider as GeoProvider


class Provider(GeoProvider):
# Source:
# https://www.latlong.net/category/cities-59-15.html
# https://github.com/33bcdd/souradnice-mest
land_coords = (
("50.50301", "13.63617", "Most", "CZ", "Europe/Prague"),
("50.23271", "12.87117", "Karlovy Vary", "CZ", "Europe/Prague"),
("50.073658", "14.418540", "Praha", "CZ", "Europe/Prague"),
("49.144482", "15.006139", "Jindřichův Hradec", "CZ", "Europe/Prague"),
("48.975658", "14.480255", "České Budějovice", "CZ", "Europe/Prague"),
("50.511002", "14.150558", "Terezín", "CZ", "Europe/Prague"),
("49.183239", "15.454273", "Telč", "CZ", "Europe/Prague"),
("49.952431", "15.268654", "Kutná Hora", "CZ", "Europe/Prague"),
("49.593777", "17.250879", "Olomouc", "CZ", "Europe/Prague"),
("49.738430", "13.373637", "Plzeň", "CZ", "Europe/Prague"),
("48.812737", "14.317466", "Český Krumlov", "CZ", "Europe/Prague"),
("49.195061", "16.606836", "Brno", "CZ", "Europe/Prague"),
("50.598427", "13.610242", "Litvínov", "CZ", "Europe/Prague"),
("49.820923", "18.262524", "Ostrava", "CZ", "Europe/Prague"),
("49.967305", "14.086384", "Beroun", "CZ", "Europe/Prague"),
("50.678620", "14.539799", "Česká Lípa", "CZ", "Europe/Prague"),
("50.772656", "14.212861", "DĚČÍN", "CZ", "Europe/Prague"),
("49.682031", "18.367422", "FRÝDEK-MÍSTEK", "CZ", "Europe/Prague"),
("49.780492", "18.430725", "HAVÍŘOV", "CZ", "Europe/Prague"),
("49.052354", "14.434371", "Hluboká nad Vltavou", "CZ", "Europe/Prague"),
("50.210461", "15.825311", "HRADEC KRÁLOVÉ", "CZ", "Europe/Prague"),
("50.463598", "13.410837", "Chomutov", "CZ", "Europe/Prague"),
("50.703569", "15.429698", "Jablonec nad Jizerou", "CZ", "Europe/Prague"),
("50.722153", "15.170414", "Jablonec nad Nisou", "CZ", "Europe/Prague"),
("50.435433", "15.361144", "Jičín", "CZ", "Europe/Prague"),
("49.415860", "15.595469", "Jihlava", "CZ", "Europe/Prague"),
("49.939604", "14.188146", "Karlštejn", "CZ", "Europe/Prague"),
("49.856752", "18.543319", "KARVINÁ", "CZ", "Europe/Prague"),
("50.141799", "14.106846", "Kladno", "CZ", "Europe/Prague"),
("50.525685", "14.047429", "Lhotka nad Labem", "CZ", "Europe/Prague"),
("49.890040", "13.581715", "Lhotka u Radnic", "CZ", "Europe/Prague"),
("50.055957", "16.268803", "Lhoty u Potštejna", "CZ", "Europe/Prague"),
("50.766380", "15.054439", "Liberec", "CZ", "Europe/Prague"),
("49.772128", "15.676917", "Maleč", "CZ", "Europe/Prague"),
("50.413525", "14.908538", "Mladá Boleslav", "CZ", "Europe/Prague"),
("49.425534", "16.256425", "Moravecké Pavlovice", "CZ", "Europe/Prague"),
("49.940760", "17.894899", "Opava", "CZ", "Europe/Prague"),
("49.916939", "17.869927", "Otice", "CZ", "Europe/Prague"),
("50.034409", "15.781299", "Pardubice", "CZ", "Europe/Prague"),
("49.472549", "17.106851", "PROSTĚJOV", "CZ", "Europe/Prague"),
("49.456579", "17.450330", "PŘEROV", "CZ", "Europe/Prague"),
("50.072880", "15.802625", "Ráby", "CZ", "Europe/Prague"),
("49.458626", "18.143131", "Rožnov pod Radhoštěm", "CZ", "Europe/Prague"),
("49.981095", "16.877925", "Ruda nad Moravou", "CZ", "Europe/Prague"),
("50.020519", "17.377529", "Rudná pod Pradědem", "CZ", "Europe/Prague"),
("50.454193", "16.036726", "Slatina nad Úpou", "CZ", "Europe/Prague"),
("49.377245", "17.670437", "Slavkov pod Hostýnem", "CZ", "Europe/Prague"),
("49.153354", "16.876598", "Slavkov u Brna", "CZ", "Europe/Prague"),
("49.991014", "15.350597", "Svatý Mikuláš", "CZ", "Europe/Prague"),
("49.977941", "16.971875", "Šumperk", "CZ", "Europe/Prague"),
("49.413089", "14.677566", "Tábor", "CZ", "Europe/Prague"),
("50.644558", "13.835384", "Teplice", "CZ", "Europe/Prague"),
("49.214887", "15.879652", "Třebíč", "CZ", "Europe/Prague"),
("49.677731", "18.670890", "Třinec", "CZ", "Europe/Prague"),
("50.151203", "16.078551", "Týniště nad Orlicí", "CZ", "Europe/Prague"),
("50.661216", "14.053246", "ÚSTÍ NAD LABEM", "CZ", "Europe/Prague"),
("49.139664", "18.008570", "Valašské Klobouky", "CZ", "Europe/Prague"),
("49.471904", "17.971237", "Valašské Meziříčí", "CZ", "Europe/Prague"),
("49.954364", "16.164268", "Vysoké Mýto", "CZ", "Europe/Prague"),
("49.224537", "17.662863", "ZLÍN", "CZ", "Europe/Prague"),
("50.538847", "16.213389", "Žďár nad Metují", "CZ", "Europe/Prague"),
("50.119855", "16.069446", "Žďár nad Orlicí", "CZ", "Europe/Prague"),
("49.564288", "15.939507", "Žďár nad Sázavou", "CZ", "Europe/Prague"),
("49.696057", "15.813706", "Ždírec nad Doubravou", "CZ", "Europe/Prague"),
)
16 changes: 16 additions & 0 deletions tests/providers/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ def test_location_on_land_coords_only(self):
assert Decimal(loc[0]) # Should be able to cast first two elements of tuple to Decimal
assert Decimal(loc[1])

class TestCsCz(unittest.TestCase):
def setUp(self):
self.fake = Faker("cs_CZ")
Faker.seed(0)

george0st marked this conversation as resolved.
Show resolved Hide resolved
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 TestDeAT(unittest.TestCase):
"""Tests in addresses in the de_AT locale"""
Expand Down
Loading