Skip to content

Commit

Permalink
black + isort fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KhoomeiK committed Nov 28, 2023
1 parent 341c66c commit 6c94685
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions bananalyzer/runner/evals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import re

from difflib import SequenceMatcher
from typing import Any, Callable, Dict

Expand Down Expand Up @@ -97,7 +96,6 @@ def is_string_similar(actual: str, expected: str, tolerance: int = 2) -> bool:
return SequenceMatcher(None, non_alnum_actual, non_alnum_expected).ratio() >= 0.7



def get_matcher(expected_value: Any, actual_value: Any) -> Callable[[Any, Any], bool]:
if isinstance(expected_value, str) and isinstance(actual_value, str):
return is_string_similar
Expand Down
16 changes: 12 additions & 4 deletions tests/test_evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@ def test_sanitize_string(input_str, expected):
("c+", "c-", 0, False),
("d---", "d+++", 1, False),
("++e+++", "---e--", 0, False),
("615 Douglas Street, Suite 500 Durham, NC 27705",
"615 Douglas Street, Suite 500, Durham, NC 27705", 2, True),
("615 Douglas Street, \n\n'Suite 500 Durham', NC 27-705",
"615 Douglas Street, Suite 500, Durham, NC 27705", 2, True),
(
"615 Douglas Street, Suite 500 Durham, NC 27705",
"615 Douglas Street, Suite 500, Durham, NC 27705",
2,
True,
),
(
"615 Douglas Street, \n\n'Suite 500 Durham', NC 27-705",
"615 Douglas Street, Suite 500, Durham, NC 27705",
2,
True,
),
],
)
def test_is_string_similar(actual, expected, tolerance, expected_result):
Expand Down

0 comments on commit 6c94685

Please sign in to comment.