def test_amazon_aazonia_distance_is_three(): edit_distance = my_levenshtein.calculate_levenshtein("amazon", "aazonia") assert edit_distance == 3
def test_asf_asfd_distance_is_one(): edit_distance = my_levenshtein.calculate_levenshtein("asf", "asfd") assert edit_distance == 1
def test_same_string_has_zero_distance(string1): edit_distance = my_levenshtein.calculate_levenshtein(string1, string1) assert edit_distance == 0
def test_different_strings_have_correct_distance(string1, string2): edit_distance = my_levenshtein.calculate_levenshtein(string1, string2) assert edit_distance == levenshtein_module.distance(string1, string2)
edit_distance = my_levenshtein.calculate_levenshtein(string1, string1) assert edit_distance == 0 def test_different_strings_have_correct_distance(string1, string2): edit_distance = my_levenshtein.calculate_levenshtein(string1, string2) assert edit_distance == levenshtein_module.distance(string1, string2) def test_asdf_asfd_distance_is_two(): edit_distance = my_levenshtein.calculate_levenshtein("asdf", "asfd") assert edit_distance == 2 def test_asf_asfd_distance_is_one(): edit_distance = my_levenshtein.calculate_levenshtein("asf", "asfd") assert edit_distance == 1 def test_amazon_aazonia_distance_is_three(): edit_distance = my_levenshtein.calculate_levenshtein("amazon", "aazonia") assert edit_distance == 3 # Test files don't usually have code for being directly run, but it's useless context here if __name__ == "__main__": test1 = string1() test2 = string2(test1) print(test1[0:20] + '...', test2[0:20] + '...') print('DISTANCE: ', my_levenshtein.calculate_levenshtein(test1, test2))