File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
pydantic_evals/pydantic_evals Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 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' )
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments