Skip to content

Commit faec697

Browse files
committed
add EvalPlayer
1 parent a40a0ec commit faec697

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from __future__ import annotations as _annotations
2+
3+
from pydantic import BaseModel, Field
4+
5+
6+
class EvalPlayer(BaseModel):
7+
"""Player in a Bradley-Terry tournament."""
8+
idx: int = Field(..., description='unique identifier for the player')
9+
item: str = Field(..., description='item to be scored')
10+
score: float | None = Field(default=None, description='Bradley-Terry strength score for the item')

tests/evals/test_tournament.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from __future__ import annotations as _annotations
2+
3+
from ..conftest import try_import
4+
5+
with try_import() as imports_successful:
6+
from pydantic_evals.tournament import EvalPlayer
7+
8+
9+
def test_evalplayer() -> None:
10+
"""
11+
Test the EvalPlayer class.
12+
"""
13+
player = EvalPlayer(
14+
idx=42,
15+
item='toasted rice & miso caramel ice cream',
16+
)
17+
assert player.idx == 42
18+
assert player.item == 'toasted rice & miso caramel ice cream'
19+

0 commit comments

Comments
 (0)