Skip to content

Commit a70229e

Browse files
othmane099othmane099
andauthored
Add automotive providers for ar_DZ and fr_DZ locales (#2346)
* add automotive provider for ar_DZ locale * add automotive provider for fr_DZ locale * follow alphabetical order --------- Co-authored-by: othmane099 <othmabe99@gmail.com>
1 parent 9dc592c commit a70229e

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from .. import Provider as AutomotiveProvider
2+
3+
4+
class Provider(AutomotiveProvider):
5+
"""Implement automotive provider for ``ar_DZ`` locale.
6+
7+
Sources:
8+
9+
- https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Algeria
10+
"""
11+
12+
WILAYA_CODES = tuple(f"{i:02d}" for i in range(1, 59))
13+
VEHICLE_CLASSES = tuple("123456789")
14+
15+
def license_plate(self) -> str:
16+
serial = self.numerify("#####")
17+
vehicle_class = self.random_element(self.VEHICLE_CLASSES)
18+
year = self.numerify("##")
19+
wilaya = self.random_element(self.WILAYA_CODES)
20+
return f"{serial} {vehicle_class}{year} {wilaya}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from ..ar_DZ import Provider as ArDzAutomotiveProvider
2+
3+
4+
class Provider(ArDzAutomotiveProvider):
5+
pass

tests/providers/test_automotive.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class TestAzAz(_SimpleAutomotiveTestMixin):
5555
license_plate_pattern = re.compile(r"\d{2}-[A-Z]{2}-\d{3}")
5656

5757

58+
class TestArDz(_SimpleAutomotiveTestMixin):
59+
"""Test ar_DZ automotive provider methods"""
60+
61+
license_plate_pattern: Pattern = re.compile(r"\d{5} [1-9]\d{2} (0[1-9]|[1-4]\d|5[0-8])")
62+
63+
5864
class TestDeAt(_SimpleAutomotiveTestMixin):
5965
"""Test de_AT automotive provider methods"""
6066

@@ -162,6 +168,10 @@ class TestFilPh(TestEnPh):
162168
pass
163169

164170

171+
class TestFrDz(TestArDz):
172+
"""Test fr_DZ automotive provider methods"""
173+
174+
165175
class TestFrFr(_SimpleAutomotiveTestMixin):
166176
"""Test fr_FR automotive provider methods"""
167177

0 commit comments

Comments
 (0)