def test_language_code_for_text():
    assert language_code_for_text(text='') == ''
    # noinspection PyTypeChecker
    assert language_code_for_text(text=None) == ''

    enabled_languages = LanguageFactory.enabled_languages()
    for language_code in enabled_languages:
        language = LanguageFactory.language_for_code(language_code)
        assert language_code == language_code_for_text(text=language.sample_sentence())
def test_identification_would_be_reliable():
    assert identification_would_be_reliable(text='') is False
    # noinspection PyTypeChecker
    assert identification_would_be_reliable(text=None) is False

    enabled_languages = LanguageFactory.enabled_languages()
    for language_code in enabled_languages:
        language = LanguageFactory.language_for_code(language_code)
        assert identification_would_be_reliable(text=language.sample_sentence())
示例#3
0
def test_identification_would_be_reliable():
    assert identification_would_be_reliable(text='') is False
    # noinspection PyTypeChecker
    assert identification_would_be_reliable(text=None) is False

    enabled_languages = LanguageFactory.enabled_languages()
    for language_code in enabled_languages:
        language = LanguageFactory.language_for_code(language_code)
        assert identification_would_be_reliable(
            text=language.sample_sentence())
示例#4
0
def test_language_code_for_text():
    assert language_code_for_text(text='') == ''
    # noinspection PyTypeChecker
    assert language_code_for_text(text=None) == ''

    enabled_languages = LanguageFactory.enabled_languages()
    for language_code in enabled_languages:
        language = LanguageFactory.language_for_code(language_code)
        assert language_code == language_code_for_text(
            text=language.sample_sentence())
示例#5
0
 def test_enabled_languages(self):
     assert 'lt' in LanguageFactory.enabled_languages()
     assert 'en' in LanguageFactory.enabled_languages()
     assert 'xx' not in LanguageFactory.enabled_languages()
示例#6
0
def test_language_code_for_text_uppercase():
    enabled_languages = LanguageFactory.enabled_languages()
    for language_code in enabled_languages:
        language = LanguageFactory.language_for_code(language_code)
        assert language_code_for_text(
            text=language.sample_sentence().upper()) == language_code
def test_language_code_for_text_uppercase():
    enabled_languages = LanguageFactory.enabled_languages()
    for language_code in enabled_languages:
        language = LanguageFactory.language_for_code(language_code)
        assert language_code_for_text(text=language.sample_sentence().upper()) == language_code
示例#8
0
 def test_enabled_languages(self):
     assert 'lt' in LanguageFactory.enabled_languages()
     assert 'en' in LanguageFactory.enabled_languages()
     assert 'xx' not in LanguageFactory.enabled_languages()