Skip to content

Commit

Permalink
Merge pull request #22 from reworkd/import-fix
Browse files Browse the repository at this point in the history
fixed formatting errors
  • Loading branch information
KhoomeiK authored Nov 28, 2023
2 parents ccb8c48 + 6c94685 commit 9003787
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 1 addition & 3 deletions bananalyzer/runner/evals.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import json
import re

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

import pytest
from deepdiff import DeepDiff
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 9003787

Please sign in to comment.