def test_smash_words_together():
    mst = textToFlex.MultiSylT('tests/dict.yaml', lang='es')
    line = "Tú el alfarero, yo el barro soy."
    result = textToFlex.syllabizeLine(line, 9, mst, lang='es')
    assert "Tú~el al -- fa -- re -- ro, yo~el ba -- rro soy." in result
    result = textToFlex.syllabizeLine(line, 8, mst, lang='es')
    assert [] == result
def test_alternates():
    mst = textToFlex.MultiSylT('tests/dict.yaml')
    line = "offering offering"
    assert "off -- ering off -- ering" in textToFlex.syllabizeLine(
        line, 4, mst)
    off5 = textToFlex.syllabizeLine(line, 5, mst)
    assert "of -- fer -- ing off -- ering" in off5
    assert "off -- ering of -- fer -- ing" in off5
def test_reformat_singular():
    mst = textToFlex.MultiSylT('tests/dict.yaml')
    line = "All? all."
    syllabized = textToFlex.syllabizeLine(line, 2, mst)
    assert [line] == syllabized

    line2 = "all, All!"
    syllabized2 = textToFlex.syllabizeLine(line2, 2, mst)
    assert [line2] == syllabized2
def test_cjk_syllabize():
    mst = textToFlex.MultiSylT('tests/dict.yaml', lang='zh')
    c = '聖哉,聖哉,聖哉,慈悲全能主宰,'
    result = textToFlex.syllabizeLine(c, 12, mst, lang='zh')
    assert '聖 -- 哉, 聖 -- 哉, 聖 -- 哉, 慈 -- 悲 -- 全 -- 能 -- 主 -- 宰,' \
        in result
    j = "よろずのくにびと、 "
    result = textToFlex.syllabizeLine(j, 8, mst, lang='ja')
    assert "よ -- ろ -- ず -- の -- く -- に -- び -- と、" in result
    k = "너희는 먼저- 추의 나라위"
    result = textToFlex.syllabizeLine(k, 10, mst, lang='ko')
    assert "너 -- 희 -- 는 먼 -- 저- 추 -- 의 나 -- 라 -- 위" in result
def test_smash_words_ignore_character():
    mst = textToFlex.MultiSylT('tests/dict.yaml', lang='es')
    line = "te adorará todo hombre"
    result = textToFlex.syllabizeLine(line, 7, mst, lang='es')
    assert "te~a -- do -- ra -- rá to -- do~hom -- bre" in result
def test_spanish_syllabize():
    mst = textToFlex.MultiSylT('tests/dict.yaml', lang='es')
    line = "Santificado sea tu nombre"
    result = textToFlex.syllabizeLine(line, 10, mst)
    assert 'es' == mst.lang
    assert "San -- ti -- fi -- ca -- do se -- a tu nom -- bre" in result