-
-
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.
Merge pull request #16 from Vuizur/split-by-comma
Split by comma + handle nested parentheses
- Loading branch information
Showing
3 changed files
with
78 additions
and
3 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,38 @@ | ||
from unittest import TestCase | ||
|
||
from proficiency.util import get_short_def | ||
|
||
|
||
class TestUtil(TestCase): | ||
def test_nested_parentheses(self) -> None: | ||
# https://en.wiktionary.org/wiki/cadet_house | ||
self.assertEqual( | ||
get_short_def( | ||
"Synonym of cadet branch (“house (dynasty) descended from one of " | ||
"the patriarch's younger sons”)", | ||
"en", | ||
), | ||
"Synonym of cadet branch", | ||
) | ||
|
||
def test_get_short_def_stop(self) -> None: | ||
# https://en.wiktionary.org/wiki/jack_jumper | ||
self.assertEqual( | ||
get_short_def( | ||
"Any of various small species of ant of the genus Myrmecia, " | ||
"often capable of jumping and having a painful sting; a jumper. " | ||
"(Also used attributively.)", | ||
"en", | ||
), | ||
"a jumper", | ||
) | ||
|
||
def test_mastodonian(self) -> None: | ||
# https://en.wiktionary.org/wiki/mastodonian | ||
self.assertEqual( | ||
get_short_def( | ||
"Of, related to, or characteristic of a mastodon; large; powerful.", | ||
"en", | ||
), | ||
"large", | ||
) |