Skip to content

Commit

Permalink
fix error message checking to work with Py 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mammothb committed Mar 21, 2024
1 parent e6fb103 commit f6f91e1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/test_editdistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


def expected_levenshtein(string_1, string_2, max_distance):
max_distance = int(min(2 ** 31 - 1, max_distance))
max_distance = int(min(2**31 - 1, max_distance))
len_1 = len(string_1)
len_2 = len(string_2)
d = np.zeros((len_1 + 1, len_2 + 1))
Expand All @@ -42,7 +42,7 @@ def expected_levenshtein(string_1, string_2, max_distance):


def expected_damerau_osa(string_1, string_2, max_distance):
max_distance = int(min(2 ** 31 - 1, max_distance))
max_distance = int(min(2**31 - 1, max_distance))
len_1 = len(string_1)
len_2 = len(string_2)
d = np.zeros((len_1 + 1, len_2 + 1))
Expand Down Expand Up @@ -145,10 +145,9 @@ def test_abstract_distance_comparer(self):
with pytest.raises(TypeError) as excinfo:
comparer = AbstractDistanceComparer()
_ = comparer.distance("string_1", "string_2", 10)
assert (
"Can't instantiate abstract class AbstractDistanceComparer with "
f"abstract method{'s' if sys.version_info[1] < 9 else ''} distance"
) == str(excinfo.value)
assert str(excinfo.value).startswith(
"Can't instantiate abstract class AbstractDistanceComparer"
)

def test_internal_distance_comparer(self, get_edit_distance):
edit_distance, expected = get_edit_distance
Expand Down

0 comments on commit f6f91e1

Please sign in to comment.