def import_file(filename): """ Import words from file with pairs separated by " - " (dash with spaces) """ print(_('Loading "%s"' % filename)) with open(filename, "r", encoding="utf-8") as f: print(_("Loaded %s words" % q.add_words_list(f)))
def test_add_words_list(self): count = q.add_words_list(''' a - b c - d e - f-g - i '''.splitlines()) self.assertEqual(count, 3) self.assertIn(('a', 'b'), q.list_words()) self.assertIn(('c', 'd'), q.list_words()) self.assertIn(('e', 'f-g - i'), q.list_words())