From 22e02a0c6dfdf7e7204531bc17b1c163155756c8 Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:03:01 -0700 Subject: [PATCH] Fix unit test --- .../tests/evals/unittests/test_save_eval.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/promptflow-evals/tests/evals/unittests/test_save_eval.py b/src/promptflow-evals/tests/evals/unittests/test_save_eval.py index 1ab43dd1b17..4d997dc18f2 100644 --- a/src/promptflow-evals/tests/evals/unittests/test_save_eval.py +++ b/src/promptflow-evals/tests/evals/unittests/test_save_eval.py @@ -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: