class TestLanguageIdentifier(object): def setup_class(self): self.langident = LanguageIdentifier() def test_identify_lang(self): assert self.langident.identify_lang('') == None assert self.langident.identify_lang(TEXT) == 'de'
class TestLanguageIdentifier(object): def setup_class(self): self.langident = LanguageIdentifier() def test_identify_lang(self): assert self.langident.identify_lang('') == None assert self.langident.identify_lang(TEXT) == 'de' def test_identify_store(self): langlist = [TranslationUnit(string) for string in TEXT_LIST] assert self.langident.identify_source_lang(langlist) == 'de' for i, unit in enumerate(langlist): unit.target = TEXT_LIST[i] assert self.langident.identify_target_lang(langlist) == 'de' def test_bad_init_data(self): """Test __init__ with bad conf files and data dirs""" assert raises(ValueError, LanguageIdentifier, model_dir='missing') assert raises(ValueError, LanguageIdentifier, conf_file='missing')
def setup_class(self): self.langident = LanguageIdentifier()