-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some name parser tests & extract method
- Loading branch information
Showing
2 changed files
with
51 additions
and
6 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
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,39 @@ | ||
import pytest | ||
|
||
from api import parsers | ||
|
||
|
||
class TestNameParser: | ||
|
||
@pytest.mark.parametrize( | ||
"name, expected", | ||
[ | ||
("a12", "aTwelve"), | ||
("a01", "aOne"), | ||
("042", "fortyTwo"), | ||
("a911bc13", "aNineHundredElevenBcThirteen"), | ||
("13_600", "thirteenSixHundred"), | ||
("a_5_6b7_$5", "aFiveSixBSevenFive"), | ||
], | ||
) | ||
def test_number_substitution(self, name: str, expected: str): | ||
assert parsers.parse_name(name) == expected | ||
|
||
@pytest.mark.parametrize( | ||
"name, expected", | ||
[ | ||
("ä", "ae"), | ||
("Ä", "Ae"), | ||
("ü", "ue"), | ||
("Ü", "Ue"), | ||
("ö", "oe"), | ||
("Ö", "Oe"), | ||
("ß", "ss"), | ||
("ẞ", "Ss"), | ||
("äh", "aeh"), | ||
("Füße", "Fuesse"), | ||
("GIEẞEN", "GIESsEN"), | ||
], | ||
) | ||
def test_umlaut_replacement(self, name: str, expected: str): | ||
assert parsers.parse_name(name) == expected |