Skip to content

Commit e805737

Browse files
committed
Update Pipfile to include missing packages. Rename TestScorer in unit tests because pytest was trying to use it as a Test class, but it can't because TestScorer inherited from a real class (with an __init__).
1 parent e226ff9 commit e805737

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

Pipfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pytest = "*"
1515
deepeval = "*"
1616
supabase = "*"
1717
requests = "*"
18+
pandas = "*"
19+
anthropic = "*"
1820

1921
[dev-packages]
2022

tests/scorers/test_custom_scorer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def a_generate(self, *args, **kwargs) -> str:
2121
def get_model_name(self, *args, **kwargs) -> str:
2222
return "mock-model"
2323

24-
class TestScorer(CustomScorer):
24+
class SampleScorer(CustomScorer):
2525
"""Concrete implementation of CustomScorer for testing"""
2626
def score_example(self, example, *args, **kwargs) -> float:
2727
return 0.8
@@ -34,7 +34,7 @@ def success_check(self) -> bool:
3434

3535
@pytest.fixture
3636
def basic_scorer():
37-
return TestScorer(
37+
return SampleScorer(
3838
score_type="test_scorer",
3939
threshold=0.7
4040
)
@@ -46,7 +46,7 @@ def mock_judge():
4646
class TestCustomScorer:
4747
def test_initialization(self):
4848
"""Test basic initialization with minimal parameters"""
49-
scorer = TestScorer(score_type="test", threshold=0.5)
49+
scorer = SampleScorer(score_type="test", threshold=0.5)
5050
assert scorer.score_type == "test"
5151
assert scorer.threshold == 0.5
5252
assert scorer.score is None
@@ -56,7 +56,7 @@ def test_initialization(self):
5656
def test_initialization_with_all_params(self):
5757
"""Test initialization with all optional parameters"""
5858
additional_metadata = {"key": "value"}
59-
scorer = TestScorer(
59+
scorer = SampleScorer(
6060
score_type="test",
6161
threshold=0.5,
6262
score=0.8,

tests/scorers/test_prompt_scorer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def mock_model():
2626
return model
2727

2828
# Simple implementation of PromptScorer for testing
29-
class TestScorer(PromptScorer):
29+
class SampleScorer(PromptScorer):
3030
def build_measure_prompt(self, example: Example) -> List[dict]:
3131
return [
3232
{"role": "system", "content": "Test system prompt"},
@@ -45,18 +45,18 @@ def success_check(self, **kwargs) -> bool:
4545
# Tests for PromptScorer
4646
class TestPromptScorer:
4747
def test_init(self):
48-
scorer = TestScorer("test_scorer")
48+
scorer = SampleScorer("test_scorer")
4949
assert scorer.name == "test_scorer"
5050
assert scorer.threshold == 0.5
5151
assert scorer.include_reason is True
5252
assert scorer.async_mode is True
5353

5454
def test_init_strict_mode(self):
55-
scorer = TestScorer("test_scorer", strict_mode=True)
55+
scorer = SampleScorer("test_scorer", strict_mode=True)
5656
assert scorer.threshold == 1
5757

5858
def test_enforce_prompt_format(self):
59-
scorer = TestScorer("test_scorer")
59+
scorer = SampleScorer("test_scorer")
6060
prompt = [{"role": "system", "content": "Base prompt"}]
6161
schema = {"score": float, "reason": str}
6262

@@ -66,21 +66,21 @@ def test_enforce_prompt_format(self):
6666
assert '"reason": <reason> (str)' in formatted[0]["content"]
6767

6868
def test_enforce_prompt_format_invalid_input(self):
69-
scorer = TestScorer("test_scorer")
69+
scorer = SampleScorer("test_scorer")
7070
with pytest.raises(TypeError):
7171
scorer.enforce_prompt_format("invalid", {})
7272

7373
@pytest.mark.asyncio
7474
async def test_a_score_example(self, example, mock_model):
75-
scorer = TestScorer("test_scorer")
75+
scorer = SampleScorer("test_scorer")
7676
scorer.model = mock_model
7777

7878
result = await scorer.a_score_example(example, _show_indicator=False)
7979
assert result == 0.8
8080
assert scorer.reason == "Test reason"
8181

8282
def test_score_example_sync(self, example, mock_model):
83-
scorer = TestScorer("test_scorer", async_mode=False)
83+
scorer = SampleScorer("test_scorer", async_mode=False)
8484
scorer.model = mock_model
8585

8686
result = scorer.score_example(example, _show_indicator=False)

0 commit comments

Comments
 (0)