def test_get_verb_dict_empty_and_null_strings(self): expected = { 'verb': Verb('play'), 'preposition': None, 'objects': 1, 'particle': None } self.assertEqual(get_verb_dict(['play', '', 'null', '', '']), expected) self.assertEqual(get_verb_dict([ 'play', 'null', '', ]), expected)
def test_get_verb_dict_phrasal_verb_single_value(self): answer = get_verb_dict(['pick up']) self.assertEqual( answer, { 'verb': Verb('pick'), 'preposition': None, 'particle': BasicWord.particle('up'), 'objects': 1 })
def test_get_verb_dict_phrasal_verb(self): answer = get_verb_dict(['take away', 'took away', 'from']) self.assertEqual( answer, { 'verb': Verb('take', 'took', ''), 'preposition': BasicWord.preposition('from'), 'particle': BasicWord.particle('away'), 'objects': 1 })
def test_get_verb_dict_no_null_values(self): answer = get_verb_dict(['fly', 'flew', 'with', '2']) self.assertEqual( answer, { 'verb': Verb('fly', 'flew', ''), 'preposition': BasicWord.preposition('with'), 'objects': 2, 'particle': None })
def test_get_verb_dict_null_values(self): answer = get_verb_dict(['fly', 'null', 'null']) self.assertEqual( answer, { 'verb': Verb('fly'), 'preposition': None, 'objects': 1, 'particle': None })
def test_get_verb_dict_preposition_has_correct_tag(self): answer = get_verb_dict(['fly', 'flew', 'with', '2']) self.assertTrue(answer['preposition'].has_tags(WordTag.PREPOSITION))