|
15 | 15 | import os |
16 | 16 | import tempfile |
17 | 17 | import time |
18 | | -import threading |
19 | | -from datetime import datetime, timezone |
20 | 18 | from pathlib import Path |
21 | | -from typing import Any |
22 | | -from unittest.mock import MagicMock, patch |
| 19 | +from unittest.mock import patch |
23 | 20 |
|
24 | 21 | import pytest |
25 | 22 | from pydantic import ValidationError |
26 | 23 |
|
27 | 24 | from evalkit.core.config import ( |
28 | 25 | EnsembleConfig, |
29 | 26 | EvalConfig, |
30 | | - JudgeConfig, |
31 | 27 | LLMProviderConfig, |
32 | 28 | StorageConfig, |
33 | 29 | ) |
|
38 | 34 | RegressionReport, |
39 | 35 | Rubric, |
40 | 36 | RubricCriteria, |
41 | | - ScoreScale, |
42 | 37 | VotingStrategy, |
43 | 38 | ) |
44 | 39 | from evalkit.core.storage import DuckDBStorage |
45 | 40 | from evalkit.generators.synthetic import SyntheticGenerator |
46 | | -from evalkit.generators.templates import GenerationStrategy, render_template |
47 | 41 | from evalkit.judges.base import BaseJudge |
48 | 42 | from evalkit.judges.ensemble import EnsembleJudge |
49 | 43 | from evalkit.judges.llm_judge import LLMJudge, _parse_judge_response |
50 | | -from evalkit.judges.rubrics import build_rubric |
51 | 44 | from evalkit.regression.comparator import ComparisonMethod, OutputComparator |
52 | 45 | from evalkit.regression.reporter import RegressionReporter |
53 | 46 | from evalkit.regression.tracker import RegressionTracker |
54 | 47 |
|
55 | | - |
56 | 48 | # --------------------------------------------------------------------------- |
57 | 49 | # Helpers |
58 | 50 | # --------------------------------------------------------------------------- |
@@ -133,11 +125,13 @@ def test_unsupported_provider_raises(self) -> None: |
133 | 125 | judge = LLMJudge(judge_id="j1", rubric=rubric, llm_config=config) |
134 | 126 |
|
135 | 127 | # Mock the api_key property to bypass env var check, then call _call_llm directly |
136 | | - with patch.object( |
137 | | - LLMProviderConfig, "api_key", new_callable=lambda: property(lambda self: "dummy") |
| 128 | + with ( |
| 129 | + patch.object( |
| 130 | + LLMProviderConfig, "api_key", new_callable=lambda: property(lambda self: "dummy") |
| 131 | + ), |
| 132 | + pytest.raises(ValueError, match="Unsupported provider"), |
138 | 133 | ): |
139 | | - with pytest.raises(ValueError, match="Unsupported provider"): |
140 | | - judge._call_llm("test prompt") |
| 134 | + judge._call_llm("test prompt") |
141 | 135 |
|
142 | 136 | def test_bad_json_from_llm_raises(self) -> None: |
143 | 137 | """If LLM returns invalid JSON, evaluate should raise ValueError.""" |
@@ -269,7 +263,7 @@ def test_from_yaml_invalid_field_type(self) -> None: |
269 | 263 | Path(path).unlink() |
270 | 264 |
|
271 | 265 | def test_from_yaml_with_extra_fields(self) -> None: |
272 | | - """Pydantic should accept extra fields without error (by default model is strict=False for extras).""" |
| 266 | + """Pydantic accepts extra fields without error (strict=False for extras).""" |
273 | 267 | import yaml |
274 | 268 |
|
275 | 269 | with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as f: |
|
0 commit comments