Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
nick863 committed Apr 17, 2024
1 parent 4af8c57 commit 22e02a0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/promptflow-evals/tests/evals/unittests/test_save_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
from promptflow.evals.evaluators import content_safety


def get_evaluators_from_module(namespace: Any, exceptions: Optional[List[str]] = None) -> List[Type]:
evaluators = []
for name, obj in inspect.getmembers(namespace):
if inspect.isclass(obj):
if exceptions and name in exceptions:
continue
evaluators.append(obj)
return evaluators


@pytest.mark.unittest
class TestSaveEval:
"""Test saving evaluators."""

@staticmethod
def _get_evaluators_from_module(namespace: Any, exceptions: Optional[List[str]] = None) -> List[Type]:
evaluators = []
for name, obj in inspect.getmembers(namespace):
if inspect.isclass(obj):
if exceptions and name in exceptions:
continue
evaluators.append(obj)
return evaluators

EVALUATORS = _get_evaluators_from_module(evaluators)
RAI_EVALUATORS = _get_evaluators_from_module(content_safety)
EVALUATORS = get_evaluators_from_module(evaluators)
RAI_EVALUATORS = get_evaluators_from_module(content_safety)

@pytest.mark.parametrize('evaluator', EVALUATORS)
def test_save_evaluators(self, tmpdir, pf_client, evaluator) -> None:
Expand Down

0 comments on commit 22e02a0

Please sign in to comment.