-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from placeTW/react_tests
Regex tests
- Loading branch information
Showing
4 changed files
with
133 additions
and
40 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
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,54 @@ | ||
from commands.react_baltics.consts import BALTIC_REGEX | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"test_str", | ||
( | ||
# Lithuanian | ||
"Taivanas", | ||
"Taivane", | ||
"Taivano", | ||
"Taivanui", | ||
"Taivanietis", | ||
"Taivanietė", | ||
"Taivaniečiai", | ||
"Taivaniečiu", | ||
"Taivaniečių", | ||
"Taivaniečiui", | ||
"Taivaniečiams", | ||
"Taivanietiškas", | ||
"Taivana", | ||
# Latvian | ||
"Taivāna", | ||
"Taivānā", | ||
"Taivānas", | ||
"Taivānai", | ||
"Taivānu", | ||
"Taivānietis", | ||
"Taivāniete", | ||
"Taivānisks", | ||
"Taivāniešu", | ||
"Taivānietim", | ||
"Taivānietei", | ||
"Taivāniešiem", | ||
"Taivānieti", | ||
"Taivāniete", | ||
"Taivānieši", | ||
"Taivānietes", | ||
"Taivānieši", | ||
# ! Estonian (STILL MISSING) | ||
), | ||
) | ||
def test_react_baltics_regex_yes_match(test_str: str): | ||
"""Tests that these strings return TRUE.""" | ||
# * isolated string | ||
assert BALTIC_REGEX.search(test_str) | ||
# * surrounded by spaces | ||
assert BALTIC_REGEX.search(f" {test_str} ") | ||
# * surrounded by text | ||
assert BALTIC_REGEX.search(f"a{test_str}b") | ||
# * to lowercase | ||
assert BALTIC_REGEX.search(test_str.lower()) | ||
# * to title case | ||
assert BALTIC_REGEX.search(test_str.title()) |
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,71 @@ | ||
from commands.reacttw.consts import TW_REGEX | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"test_str", | ||
( | ||
"TAIWAN", | ||
"FORMOSA", | ||
"TAIPEI", | ||
"TAOYUAN", | ||
"TAICHUNG", | ||
"TAINAN", | ||
"KAOHSIUNG", | ||
"MIAOLI", | ||
"CHANGHUA", | ||
"NANTOU", | ||
"YUNLIN", | ||
"PINGTUNG", | ||
"YILAN", | ||
"HUALIEN", | ||
"TAITUNG", | ||
"PENGHU", | ||
"KINMEN", | ||
"LIENCHIANG", | ||
"KEELUNG", | ||
"HSINCHU", | ||
"CHIAYI", | ||
"台灣", | ||
"臺灣", | ||
"臺北", | ||
"台北", | ||
"新北", | ||
"桃園", | ||
"臺中", | ||
"台中", | ||
"臺南", | ||
"台南", | ||
"高雄", | ||
"新竹", | ||
"苗栗", | ||
"彰化", | ||
"南投", | ||
"雲林", | ||
"嘉義", | ||
"屏東", | ||
"宜蘭", | ||
"花蓮", | ||
"臺東", | ||
"台東", | ||
"澎湖", | ||
"金門", | ||
"連江", | ||
"基隆", | ||
"新竹", | ||
"嘉義", | ||
"美麗島", | ||
), | ||
) | ||
def test_react_tw_regex_yes_match(test_str: str): | ||
"""Tests that these strings return TRUE.""" | ||
# * isolated string | ||
assert TW_REGEX.search(test_str) | ||
# * surrounded by spaces | ||
assert TW_REGEX.search(f" {test_str} ") | ||
# * surrounded by text | ||
assert TW_REGEX.search(f"a{test_str}b") | ||
# * to lowercase | ||
assert TW_REGEX.search(test_str.lower()) | ||
# * to title case | ||
assert TW_REGEX.search(test_str.title()) |