forked from optuna/optuna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_structs.py
49 lines (38 loc) · 1.25 KB
/
test_structs.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import datetime
import pytest
from optuna.distributions import UniformDistribution
from optuna.structs import FrozenTrial
from optuna.structs import StudyDirection
from optuna.structs import StudySummary
from optuna.structs import TrialPruned
from optuna.structs import TrialState
def test_frozen_trial_deprecated() -> None:
with pytest.warns(FutureWarning):
FrozenTrial(
number=0,
trial_id=0,
state=TrialState.COMPLETE,
value=0.2,
datetime_start=datetime.datetime.now(),
datetime_complete=datetime.datetime.now(),
params={"x": 10},
distributions={"x": UniformDistribution(5, 12)},
user_attrs={},
system_attrs={},
intermediate_values={},
)
def test_study_summary_deprecated() -> None:
with pytest.warns(FutureWarning):
StudySummary(
study_name="test",
direction=StudyDirection.NOT_SET,
best_trial=None,
user_attrs={},
system_attrs={},
n_trials=0,
datetime_start=datetime.datetime.now(),
study_id=0,
)
def test_trial_pruned_deprecated() -> None:
with pytest.warns(FutureWarning):
TrialPruned()