예제 #1
0
def test_romanize_russian_alphabet():
    result = ("A B V G D E Yo Zh Z I Ye K L M N O P R S T U F Kh Ts "
              "Ch Sh Shch  Y  E Yu Ja a b v g d e yo zh z i ye k l m n"
              " o p r s t u f kh ts ch sh shch  y  e yu ja")

    russian_alphabet = " ".join("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"
                                "абвгдеёжзийклмнопрстуфхцчшщъыьэюя")

    assert shortcuts.romanize(russian_alphabet, locale=Locale.RU) == result
예제 #2
0
def test_romanize_missing_positional_arguments():
    with pytest.raises(TypeError):
        shortcuts.romanize()

    with pytest.raises(TypeError):
        shortcuts.romanize(locale=Locale.RU)

    with pytest.raises(TypeError):
        shortcuts.romanize(string="ТЕСТ")
예제 #3
0
def test_romanize_unsupported_locale():
    with pytest.raises(ValueError):
        shortcuts.romanize("Mimesis", locale=Locale.DE)
예제 #4
0
def test_romanize_invalid_locale():
    with pytest.raises(LocaleError):
        shortcuts.romanize("Mimesis", locale="sdsdsd")
예제 #5
0
def test_romanize_kazakh_text():
    expected_result = "Python - eñ zhaqsy bağdarlamalau tili!"
    assert (shortcuts.romanize("Python - ең жақсы бағдарламалау тілі!",
                               locale=Locale.KK) == expected_result)
예제 #6
0
def test_romanize_ukrainian_text():
    assert (shortcuts.romanize("Українська мова!",
                               locale=Locale.UK) == "Ukrayins’ka mova!")
예제 #7
0
def test_romanize_russian_mixed_text():
    assert (shortcuts.romanize("Что-то там_4352-!@",
                               locale=Locale.RU) == "Chto-to tam_4352-!@")
예제 #8
0
def test_romanize_russian_string():
    assert shortcuts.romanize("Ликид Геимфари",
                              locale=Locale.RU) == "Likid Geimfari"