Skip to content

Commit e7d5cf2

Browse files
committed
Fix test
1 parent ff243c8 commit e7d5cf2

1 file changed

Lines changed: 46 additions & 1 deletion

File tree

tests/providers/test_geo.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,56 @@
77
from faker.providers.geo.pt_PT import Provider as PtPtProvider
88

99

10-
class TestArDz(TestEnUS):
10+
class TestArDz(unittest.TestCase):
1111
def setUp(self):
1212
self.fake = Faker("ar_DZ")
1313
Faker.seed(0)
1414

15+
def test_latitude(self):
16+
lat = self.fake.latitude()
17+
assert isinstance(lat, Decimal)
18+
19+
def test_longitude(self):
20+
long = self.fake.longitude()
21+
assert isinstance(long, Decimal)
22+
23+
def test_latlng(self):
24+
loc = self.fake.latlng()
25+
assert isinstance(loc, tuple)
26+
assert len(loc) == 2
27+
assert isinstance(loc[0], Decimal)
28+
assert isinstance(loc[1], Decimal)
29+
30+
def test_coordinate(self):
31+
loc = self.fake.coordinate()
32+
assert isinstance(loc, Decimal)
33+
34+
def test_coordinate_centered(self):
35+
loc = self.fake.coordinate(center=23)
36+
assert round(loc) == 23
37+
38+
def test_coordinate_rounded(self):
39+
loc = self.fake.coordinate(center=23, radius=3)
40+
assert 20 <= round(loc) <= 26
41+
42+
def test_location_on_land(self):
43+
loc = self.fake.location_on_land()
44+
assert isinstance(loc, tuple)
45+
assert len(loc) == 5
46+
assert Decimal(loc[0]) # Should be able to cast first two elements of tuple to Decimal
47+
assert Decimal(loc[1])
48+
assert isinstance(loc[2], str) # Place is a string
49+
assert isinstance(loc[3], str) # Country code is a string
50+
assert len(loc[3]) == 2 # Country code is two letters
51+
assert isinstance(loc[4], str) # Timezone is a string
52+
53+
def test_location_on_land_coords_only(self):
54+
loc = self.fake.location_on_land(coords_only=True)
55+
assert isinstance(loc, tuple)
56+
assert len(loc) == 2
57+
assert Decimal(loc[0]) # Should be able to cast first two elements of tuple to Decimal
58+
assert Decimal(loc[1])
59+
1560

1661
class TestCsCz(unittest.TestCase):
1762
def setUp(self):

0 commit comments

Comments
 (0)