-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathtest_training_utils.py
More file actions
32 lines (20 loc) · 1004 Bytes
/
Copy pathtest_training_utils.py
File metadata and controls
32 lines (20 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest
from eval_protocol.models import EPParameters
from eval_protocol.training.utils import build_ep_parameters_from_test
def test_build_ep_parameters_from_test_returns_attached_model():
"""build_ep_parameters_from_test should return the EPParameters attached to the test function."""
def dummy_test() -> None:
pass
params = EPParameters(num_runs=3, completion_params={"model": "gpt-4"})
setattr(dummy_test, "__ep_params__", params)
result = build_ep_parameters_from_test(dummy_test)
assert result is params
assert result.num_runs == 3
assert result.completion_params == {"model": "gpt-4"}
def test_build_ep_parameters_from_test_missing_attr_raises():
"""build_ep_parameters_from_test should raise when __ep_params__ is missing."""
def dummy_test_no_attr() -> None:
pass
with pytest.raises(ValueError) as exc_info:
build_ep_parameters_from_test(dummy_test_no_attr)
assert "__ep_params__" in str(exc_info.value)