|
7 | 7 | from faker.providers.geo.pt_PT import Provider as PtPtProvider |
8 | 8 |
|
9 | 9 |
|
10 | | -class TestArDz(TestEnUS): |
| 10 | +class TestArDz(unittest.TestCase): |
11 | 11 | def setUp(self): |
12 | 12 | self.fake = Faker("ar_DZ") |
13 | 13 | Faker.seed(0) |
14 | 14 |
|
| 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 | + |
15 | 60 |
|
16 | 61 | class TestCsCz(unittest.TestCase): |
17 | 62 | def setUp(self): |
|
0 commit comments