-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vi-VN automotive provider (#1639)
* Add vi-VN automotive provider * Update test_automotive.py * Update test_automotive.py Co-authored-by: Flavio Curella <89607+fcurella@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import re | ||
|
||
from .. import Provider as AutomotiveProvider | ||
|
||
|
||
class Provider(AutomotiveProvider): | ||
"""Implement automotive provider for ``vi_VN`` locale. | ||
Sources: | ||
- https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Vietnam | ||
""" | ||
|
||
license_formats = ("##?-#####",) | ||
ascii_uppercase_vietnamese = "ABCDĐEFGHKLMNPSTUVXYZ" | ||
|
||
def license_plate(self) -> str: | ||
"""Generate a license plate.""" | ||
temp = re.sub( | ||
r"\?", | ||
lambda x: self.random_element(self.ascii_uppercase_vietnamese), | ||
self.random_element(self.license_formats), | ||
) | ||
return self.numerify(temp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters