Beispiel #1
0
 def test_find_verb_group_upper_case(self):
     submission_str = 'the dogs Play.'
     word = Verb('play')
     answer = find_verb_group(word, submission_str)
     start = len('the Dogs ')
     end = start + len('Play')
     self.assertEqual(answer, (start, end))
Beispiel #2
0
 def test_find_verb_group_submission_str_irregular_past(self):
     submission_str = 'I went home.'
     base_verb = Verb('go', 'went')
     answer = find_verb_group(base_verb, submission_str)
     start = submission_str.find('went')
     end = start + len('went')
     self.assertEqual(answer, (start, end))
Beispiel #3
0
 def test_find_verb_group_submission_str_special_rule_regular_past_tense(
         self):
     submission_str = 'He babied me.'
     word = Verb('baby')
     answer = find_verb_group(word, submission_str)
     start = submission_str.find('babied')
     end = start + len('babied')
     self.assertEqual(answer, (start, end))
Beispiel #4
0
 def test_find_verb_group_all_prefixes(self):
     prefixes = ["Don't", "don't", "Doesn't", "doesn't", "Didn't", "didn't"]
     verb = Verb('play')
     for prefix in prefixes:
         submission_str = f'the cat {prefix} play here.'
         answer = find_verb_group(verb, submission_str)
         start = len('the cat ')
         end = start + len(f'{prefix} play')
         self.assertEqual(answer, (start, end))
Beispiel #5
0
 def test_find_verb_group_all_verb_forms_simple(self):
     submission_str = 'i go home.'
     go = Verb('go', 'went')
     verbs = [
         go,
         go.third_person(),
         go.negative(),
         go.negative().third_person(),
         go.past_tense(),
         go.negative().past_tense()
     ]
     capital_verbs = [verb.capitalize() for verb in verbs]
     for verb in verbs + capital_verbs:
         answer = find_verb_group(verb, submission_str)
         expected = (2, 4)
         self.assertEqual(answer, expected)
Beispiel #6
0
 def test_find_verb_group_all_verb_forms_complex(self):
     submission_str = "i didn't went home."
     go = Verb('go', 'went')
     verbs = [
         go,
         go.third_person(),
         go.negative(),
         go.negative().third_person(),
         go.past_tense(),
         go.negative().past_tense()
     ]
     capital_verbs = [verb.capitalize() for verb in verbs]
     for verb in verbs + capital_verbs:
         answer = find_verb_group(verb, submission_str)
         start = submission_str.find("didn't went")
         end = start + len("didn't went")
         self.assertEqual(answer, (start, end))
Beispiel #7
0
 def test_find_verb_group_verb_not_present(self):
     submission_str = ''
     verb = Verb('play')
     self.assertIsNone(find_verb_group(verb, submission_str))