Exemple #1
0
 def test_verbs_bad_verb_mismatched_particles(self):
     bad_verbs = os.path.join(TESTS_FILES, 'bad_verbs.csv')
     with open(bad_verbs, 'w') as f:
         f.write('take out, took away')
     with self.assertRaises(LoaderError) as cm:
         verbs(bad_verbs)
     self.assertEqual(
         cm.exception.args[0],
         'Phrasal verb, "take", has mismatched particles: "out" and "away".'
     )
     os.remove(bad_verbs)
Exemple #2
0
 def test_init_loads_in_csv_paths(self):
     pg = ParagraphsGenerator(self.config_state)
     self.assertEqual(pg._verbs_list, verbs(DELETE_ME_VERBS))
     all_nouns = (countable_nouns(DELETE_ME_COUNTABLE) +
                  uncountable_nouns(DELETE_ME_UNCOUNTABLE) +
                  proper_nouns(DELETE_ME_PROPER))
     self.assertEqual(pg._nouns_list, all_nouns)
    def load_lists_from_file(self):
        self._verbs_list = verbs(self._options['verbs'])

        self._nouns_list = countable_nouns(self._options['countable_nouns'])
        self._nouns_list += uncountable_nouns(
            self._options['uncountable_nouns'])
        self._nouns_list += proper_nouns(self._options['proper_nouns'])
Exemple #4
0
 def test_verbs_with_insert_preposition(self):
     filename = os.path.join(TESTS_FILES, 'bring_to.csv')
     answer = verbs(filename)
     bring_to = {
         'verb': Verb('bring', 'brought', ''),
         'preposition': BasicWord.preposition('to'),
         'objects': 2,
         'particle': None
     }
     self.assertEqual(answer, [bring_to])
Exemple #5
0
 def test_verbs_empty_csv(self):
     self.assertEqual(verbs(os.path.join(TESTS_FILES, 'empty.csv')), [])