-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add zh_CN automotive license_plate rules and test functions (#1858)
* Add `license_plate` for `zh_CN`
- Loading branch information
1 parent
294768d
commit 9a68dfd
Showing
2 changed files
with
53 additions
and
0 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,47 @@ | ||
from .. import Provider as AutomotiveProvider | ||
|
||
|
||
class Provider(AutomotiveProvider): | ||
""" | ||
Implement automotive provider for `zh_CN` locale. | ||
electric vehicles or downtown-restricted plates are not included | ||
""" | ||
|
||
province_code = ( | ||
"京", | ||
"津", | ||
"冀", | ||
"晋", | ||
"蒙", | ||
"辽", | ||
"吉", | ||
"黑", | ||
"沪", | ||
"苏", | ||
"浙", | ||
"皖", | ||
"闽", | ||
"赣", | ||
"鲁", | ||
"豫", | ||
"鄂", | ||
"湘", | ||
"粤", | ||
"桂", | ||
"琼", | ||
"渝", | ||
"川", | ||
"贵", | ||
"云", | ||
"藏", | ||
"陕", | ||
"甘", | ||
"青", | ||
"宁", | ||
"新", | ||
) | ||
|
||
def license_plate(self) -> str: | ||
"""Generate a license plate.""" | ||
pattern: str = str(self.random_element(self.province_code)) + self.random_uppercase_letter() + "-#####" | ||
return self.numerify(self.generator.parse(pattern)) |
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