Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbachmann committed Nov 1, 2023
1 parent 35d3b9e commit b48575f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/test_JaroWinkler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_hash_special_case(self):
self._jaro_winkler_similarity([0, -1], [0, -2], 0.66666)

def test_edge_case_lengths(self):
self._jaro_winkler_similarity("", "", 0)
self._jaro_winkler_similarity("", "", 1)
self._jaro_winkler_similarity("0", "0", 1)
self._jaro_winkler_similarity("00", "00", 1)
self._jaro_winkler_similarity("0", "00", 0.85)
Expand Down
11 changes: 7 additions & 4 deletions tests/test_hypothesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):


def jaro_similarity(P, T):
P_flag = [0] * (len(P) + 1)
T_flag = [0] * (len(T) + 1)
if not P and not T:
return 1.0

P_flag = [False] * (len(P) + 1)
T_flag = [False] * (len(T) + 1)

Bound = max(len(P), len(T)) // 2
Bound = max(Bound - 1, 0)
Expand All @@ -23,8 +26,8 @@ def jaro_similarity(P, T):

for j in range(lowlim, hilim + 1):
if not P_flag[j] and P[j] == T[i]:
T_flag[i] = 1
P_flag[j] = 1
T_flag[i] = True
P_flag[j] = True
CommonChars += 1
break

Expand Down

0 comments on commit b48575f

Please sign in to comment.