Run black reformatter on code

This commit is contained in:
Griatch 2022-02-08 13:03:52 +01:00
parent 4582eb4085
commit bd3e31bf3c
178 changed files with 4511 additions and 3385 deletions

View file

@ -13,32 +13,37 @@ class TestVerbConjugate(TestCase):
Test the conjugation.
"""
@parameterized.expand([
("have", "have"),
("swim", "swim"),
("give", "give"),
("given", "give"),
("am", "be"),
("doing", "do"),
("are", "be"),
])
@parameterized.expand(
[
("have", "have"),
("swim", "swim"),
("give", "give"),
("given", "give"),
("am", "be"),
("doing", "do"),
("are", "be"),
]
)
def test_verb_infinitive(self, verb, expected):
"""
Test the infinite-getter.
"""
self.assertEqual(expected, conjugate.verb_infinitive(verb))
@parameterized.expand([
("inf", "have", "have"),
("inf", "swim", "swim"),
("inf", "give", "give"),
("inf", "given", "give"),
("inf", "am", "be"),
("inf", "doing", "do"),
("inf", "are", "be"),
("2sgpres", "am", "are"),
("3sgpres", "am", "is"),
])
@parameterized.expand(
[
("inf", "have", "have"),
("inf", "swim", "swim"),
("inf", "give", "give"),
("inf", "given", "give"),
("inf", "am", "be"),
("inf", "doing", "do"),
("inf", "are", "be"),
("2sgpres", "am", "are"),
("3sgpres", "am", "is"),
]
)
def test_verb_conjugate(self, tense, verb, expected):
"""
Test conjugation for different tenses.
@ -46,17 +51,19 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_conjugate(verb, tense=tense))
@parameterized.expand([
("1st", "have", "have"),
("1st", "swim", "swim"),
("1st", "give", "give"),
("1st", "given", "give"),
("1st", "am", "am"),
("1st", "doing", "do"),
("1st", "are", "am"),
("2nd", "were", "are"),
("3rd", "am", "is"),
])
@parameterized.expand(
[
("1st", "have", "have"),
("1st", "swim", "swim"),
("1st", "give", "give"),
("1st", "given", "give"),
("1st", "am", "am"),
("1st", "doing", "do"),
("1st", "are", "am"),
("2nd", "were", "are"),
("3rd", "am", "is"),
]
)
def test_verb_present(self, person, verb, expected):
"""
Test the present.
@ -64,15 +71,17 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_present(verb, person=person))
@parameterized.expand([
("have", "having"),
("swim", "swimming"),
("give", "giving"),
("given", "giving"),
("am", "being"),
("doing", "doing"),
("are", "being"),
])
@parameterized.expand(
[
("have", "having"),
("swim", "swimming"),
("give", "giving"),
("given", "giving"),
("am", "being"),
("doing", "doing"),
("are", "being"),
]
)
def test_verb_present_participle(self, verb, expected):
"""
Test the present_participle
@ -80,16 +89,18 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_present_participle(verb))
@parameterized.expand([
("1st", "have", "had"),
("1st", "swim", "swam"),
("1st", "give", "gave"),
("1st", "given", "gave"),
("1st", "am", "was"),
("1st", "doing", "did"),
("1st", "are", "was"),
("2nd", "were", "were"),
])
@parameterized.expand(
[
("1st", "have", "had"),
("1st", "swim", "swam"),
("1st", "give", "gave"),
("1st", "given", "gave"),
("1st", "am", "was"),
("1st", "doing", "did"),
("1st", "are", "was"),
("2nd", "were", "were"),
]
)
def test_verb_past(self, person, verb, expected):
"""
Test the past getter.
@ -97,15 +108,17 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_past(verb, person=person))
@parameterized.expand([
("have", "had"),
("swim", "swum"),
("give", "given"),
("given", "given"),
("am", "been"),
("doing", "done"),
("are", "been"),
])
@parameterized.expand(
[
("have", "had"),
("swim", "swum"),
("give", "given"),
("given", "given"),
("am", "been"),
("doing", "done"),
("are", "been"),
]
)
def test_verb_past_participle(self, verb, expected):
"""
Test the past participle.
@ -120,15 +133,17 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(list(conjugate.verb_tenses_keys.keys()), conjugate.verb_all_tenses())
@parameterized.expand([
("have", "infinitive"),
("swim", "infinitive"),
("give", "infinitive"),
("given", "past participle"),
("am", "1st singular present"),
("doing", "present participle"),
("are", "2nd singular present"),
])
@parameterized.expand(
[
("have", "infinitive"),
("swim", "infinitive"),
("give", "infinitive"),
("given", "past participle"),
("am", "1st singular present"),
("doing", "present participle"),
("are", "2nd singular present"),
]
)
def test_verb_tense(self, verb, expected):
"""
Test the tense retriever.
@ -136,15 +151,17 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_tense(verb))
@parameterized.expand([
("inf", "have", True),
("inf", "swim", True),
("inf", "give", True),
("inf", "given", False),
("inf", "am", False),
("inf", "doing", False),
("inf", "are", False),
])
@parameterized.expand(
[
("inf", "have", True),
("inf", "swim", True),
("inf", "give", True),
("inf", "given", False),
("inf", "am", False),
("inf", "doing", False),
("inf", "are", False),
]
)
def test_verb_is_tense(self, tense, verb, expected):
"""
Test the tense-checker
@ -152,16 +169,18 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_is_tense(verb, tense))
@parameterized.expand([
("1st", "have", False),
("1st", "swim", False),
("1st", "give", False),
("1st", "given", False),
("1st", "am", True),
("1st", "doing", False),
("1st", "are", False),
("1st", "had", False),
])
@parameterized.expand(
[
("1st", "have", False),
("1st", "swim", False),
("1st", "give", False),
("1st", "given", False),
("1st", "am", True),
("1st", "doing", False),
("1st", "are", False),
("1st", "had", False),
]
)
def test_verb_is_present(self, person, verb, expected):
"""
Test the tense-checker
@ -169,15 +188,17 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_is_present(verb, person=person))
@parameterized.expand([
("have", False),
("swim", False),
("give", False),
("given", False),
("am", False),
("doing", True),
("are", False),
])
@parameterized.expand(
[
("have", False),
("swim", False),
("give", False),
("given", False),
("am", False),
("doing", True),
("are", False),
]
)
def test_verb_is_present_participle(self, verb, expected):
"""
Test the tense-checker
@ -185,16 +206,18 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_is_present_participle(verb))
@parameterized.expand([
("1st", "have", False),
("1st", "swim", False),
("1st", "give", False),
("1st", "given", False),
("1st", "am", False),
("1st", "doing", False),
("1st", "are", False),
("2nd", "were", True),
])
@parameterized.expand(
[
("1st", "have", False),
("1st", "swim", False),
("1st", "give", False),
("1st", "given", False),
("1st", "am", False),
("1st", "doing", False),
("1st", "are", False),
("2nd", "were", True),
]
)
def test_verb_is_past(self, person, verb, expected):
"""
Test the tense-checker
@ -202,16 +225,18 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_is_past(verb, person=person))
@parameterized.expand([
("have", False),
("swimming", False),
("give", False),
("given", True),
("am", False),
("doing", False),
("are", False),
("had", False),
])
@parameterized.expand(
[
("have", False),
("swimming", False),
("give", False),
("given", True),
("am", False),
("doing", False),
("are", False),
("had", False),
]
)
def test_verb_is_past_participle(self, verb, expected):
"""
Test the tense-checker
@ -219,20 +244,22 @@ class TestVerbConjugate(TestCase):
"""
self.assertEqual(expected, conjugate.verb_is_past_participle(verb))
@parameterized.expand([
("have", ("have", "has")),
("swimming", ("swimming", "swimming")),
("give", ("give", "gives")),
("given", ("given", "given")),
("am", ("are", "is")),
("doing", ("doing", "doing")),
("are", ("are", "is")),
("had", ("had", "had")),
("grin", ("grin", "grins")),
("smile", ("smile", "smiles")),
("vex", ("vex", "vexes")),
("thrust", ("thrust", "thrusts")),
])
@parameterized.expand(
[
("have", ("have", "has")),
("swimming", ("swimming", "swimming")),
("give", ("give", "gives")),
("given", ("given", "given")),
("am", ("are", "is")),
("doing", ("doing", "doing")),
("are", ("are", "is")),
("had", ("had", "had")),
("grin", ("grin", "grins")),
("smile", ("smile", "smiles")),
("vex", ("vex", "vexes")),
("thrust", ("thrust", "thrusts")),
]
)
def test_verb_actor_stance_components(self, verb, expected):
"""
Test the tense-checker
@ -247,40 +274,42 @@ class TestPronounMapping(TestCase):
"""
@parameterized.expand([
("you", "m", "you", "he"),
("you", "f op", "you", "her"),
("I", "", "I", "it"),
("I", "p", "I", "it"), # plural is invalid
("I", "m", "I", "he"),
("Me", "n", "Me", "It"),
("your", "p", "your", "their"),
("ours", "", "ours", "theirs"),
("yourself", "", "yourself", "itself"),
("yourself", "m", "yourself", "himself"),
("yourself", "f", "yourself", "herself"),
("yourself", "p", "yourself", "itself"), # plural is invalid
("yourselves", "", "yourselves", "themselves"),
("he", "", "you", "he"), # assume 2nd person
("he", "1", "I", "he"),
("he", "1 p", "we", "he"),
("her", "p", "you", "her"),
("her", "pa", "your", "her"),
("their", "pa", "your", "their"),
("their", "pa", "your", "their"),
("itself", "", "yourself", "itself"),
("themselves", "", "yourselves", "themselves"),
("herself", "", "yourself", "herself"),
])
def test_mapping_with_options(self, pronoun, options,
expected_1st_or_2nd_person,
expected_3rd_person):
@parameterized.expand(
[
("you", "m", "you", "he"),
("you", "f op", "you", "her"),
("I", "", "I", "it"),
("I", "p", "I", "it"), # plural is invalid
("I", "m", "I", "he"),
("Me", "n", "Me", "It"),
("your", "p", "your", "their"),
("ours", "", "ours", "theirs"),
("yourself", "", "yourself", "itself"),
("yourself", "m", "yourself", "himself"),
("yourself", "f", "yourself", "herself"),
("yourself", "p", "yourself", "itself"), # plural is invalid
("yourselves", "", "yourselves", "themselves"),
("he", "", "you", "he"), # assume 2nd person
("he", "1", "I", "he"),
("he", "1 p", "we", "he"),
("her", "p", "you", "her"),
("her", "pa", "your", "her"),
("their", "pa", "your", "their"),
("their", "pa", "your", "their"),
("itself", "", "yourself", "itself"),
("themselves", "", "yourselves", "themselves"),
("herself", "", "yourself", "herself"),
]
)
def test_mapping_with_options(
self, pronoun, options, expected_1st_or_2nd_person, expected_3rd_person
):
"""
Test the pronoun mapper.
"""
received_1st_or_2nd_person, received_3rd_person = (
pronouns.pronoun_to_viewpoints(pronoun, options)
received_1st_or_2nd_person, received_3rd_person = pronouns.pronoun_to_viewpoints(
pronoun, options
)
self.assertEqual(expected_1st_or_2nd_person, received_1st_or_2nd_person)