示例#1
0
def test_tone_tone2(pinyin, result):
    assert tone_to_tone2(pinyin) == result
    assert to_tone2(pinyin) == result

    assert tone2_to_tone(result) == pinyin

    assert to_tone(result) == pinyin
    assert to_tone(pinyin) == pinyin
    assert to_tone2(result) == result
示例#2
0
def test_tone_tone2_with_neutral_tone_with_5(pinyin, neutral_tone_with_5,
                                             result):
    assert tone_to_tone2(pinyin,
                         neutral_tone_with_5=neutral_tone_with_5) == result
    assert to_tone2(pinyin, neutral_tone_with_5=neutral_tone_with_5) == result

    assert tone2_to_tone(result) == pinyin
    assert to_tone(result) == pinyin
示例#3
0
def test_tone_to_tone2_tone3_to_tone():
    pinyin_set = set()
    for py in pinyin_dict.pinyin_dict.values():
        pinyin_set.update(py.split(','))

    for py in pinyin_set:
        tone2 = tone_to_tone2(py)
        assert tone2_to_tone(tone2) == py
        assert to_tone(tone2) == py

        tone2_3 = tone2_to_tone3(tone2)
        assert tone3_to_tone(tone2_3) == py
        assert to_tone(tone2_3) == py

        #
        tone3 = tone_to_tone3(py)
        assert tone3_to_tone(tone3) == py
        assert to_tone(tone3) == py

        tone3_2 = tone3_to_tone2(tone3)
        assert tone2_to_tone(tone3_2) == py
        assert to_tone(tone3_2) == py
示例#4
0
def test_tone_tone3_with_neutral_tone_with_five(
        pinyin, neutral_tone_with_five, result):
    assert tone_to_tone3(
        pinyin, neutral_tone_with_five=neutral_tone_with_five) == result
    assert tone_to_tone3(
        pinyin, neutral_tone_with_5=neutral_tone_with_five) == result
    assert to_tone3(
        pinyin, neutral_tone_with_five=neutral_tone_with_five) == result
    assert to_tone3(
        pinyin, neutral_tone_with_5=neutral_tone_with_five) == result

    assert tone3_to_tone(result) == pinyin
    assert to_tone(result) == pinyin
示例#5
0
def test_tone_tone2_with_v_to_u(pinyin, v_to_u, result):
    assert tone_to_tone2(pinyin, v_to_u=v_to_u) == result
    assert to_tone2(pinyin, v_to_u=v_to_u) == result

    assert tone2_to_tone(result) == pinyin
    assert to_tone(result) == pinyin