def test_no_sub_is_different(): source = "aabbc" target = "aabbz" assert levenshtein(source, target) != levenshtein_no_sub(source, target)
def test_levenshtein_no_subboth_empty(): source = "" target = "" gold = 0 assert levenshtein_no_sub(source, target) == gold
def test_levenshtein_no_sub_empty_target(): source = "aaaaa" target = "" gold = len(source) * 1 assert levenshtein_no_sub(source, target) == gold
def test_levenshtein_no_sub_longer_target(): source = "aaaaa" target = "aaaaaaaa" gold = abs(len(source) - len(target)) * 1 assert levenshtein_no_sub(source, target) == gold
def test_levenshtein_no_sub(): source = "intention" target = "execution" gold = 8 assert levenshtein_no_sub(source, target) == gold
def real_test(source, target): lcs = longest_common_subsequence(source, target) gold = levenshtein_no_sub(source, target) assert (len(source) + len(target) - (2 * lcs)) == gold