Пример #1
0
def test_levenshtein_both_empty():
    source = ""
    target = ""
    gold = 0
    assert levenshtein(source, target) == gold
Пример #2
0
def test_no_sub_is_different():
    source = "aabbc"
    target = "aabbz"
    assert levenshtein(source, target) != levenshtein_no_sub(source, target)
Пример #3
0
def test_levenshtein_empty_target():
    source = "aaaaa"
    target = ""
    gold = len(source) * 1
    assert levenshtein(source, target) == gold
Пример #4
0
def test_levenshtein_longer_target():
    source = "aaaaa"
    target = "aaaaaaaa"
    gold = abs(len(source) - len(target)) * 1
    assert levenshtein(source, target) == gold
Пример #5
0
def test_levenshtein():
    source = "intention"
    target = "execution"
    gold = 5
    assert levenshtein(source, target) == gold
Пример #6
0
def test_dl_is_different():
    source = "aaabbb"
    target = "aababb"
    assert damerau_levenshtein(source, target) != levenshtein(source, target)
def test_dl_is_different():
    source = "agdaabbvnb"
    target = "aedababicb"
    assert damerau_levenshtein(source, target) != levenshtein(source, target)
    assert damerau_levenshtein(source,
                               target) == levenshtein(source, target) - 1