def setUp(self): self.nonempty_lines = [ 'pl;br;en;group', 'kobieta;a mulher;woman;basics', 'chłopiec;o menino;boy;basics2', ] self.expected_entries = [ { u'pl': u'kobieta', u'br': u'a mulher', u'en': u'woman', u'group': u'basics', }, { u'pl': u'chłopiec', u'br': u'o menino', u'en': u'boy', u'group': u'basics2', }, ] self.empty_dict = WordsDict.from_string_io(['pl;br;en;group', ]) self.nonempty_dict = WordsDict.from_string_io(self.nonempty_lines) self.nonempty_dict_cut = WordsDict.from_string_io(self.nonempty_lines).apply_filter(CountFilter(1)) self.nonempty_dict_bigcut = WordsDict.from_string_io(self.nonempty_lines).apply_filter(CountFilter(3)) self.reset_dict = WordsDict.from_string_io(self.nonempty_lines).apply_filter(CountFilter(1))
def setUp(self): self.multi_lines = [ 'pl;br;en;group', 'cześć;oi|olá;hi|hello;basics', 'dzień;o dia;day;basics', ] self.multi_dict = WordsDict.from_string_io(self.multi_lines) #self.multi_dict = WordsDict.from_string_io_unicode(self.multi_lines) self.test_engine = WordsTestEngine(self.multi_dict, u'pl', u'br')
def test_not_equal_file(self): with self.assertRaises(ValueError): WordsDict.from_string_io(['pl;br;group', 'kobieta;basics', ])
def test_no_group_file(self): with self.assertRaises(ValueError): WordsDict.from_string_io(['pl;br', ])
def test_empty_file(self): with self.assertRaises(ValueError): WordsDict.from_string_io([])