Skip to content

Commit

Permalink
Fix broken tests for get_trial_id_from_study_id_trial_number storage …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
c-bata committed Aug 30, 2022
1 parent faed73c commit ce674ac
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions tests/study_tests/test_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,22 +1485,12 @@ def test_tell_duplicate_tell() -> None:
def test_tell_storage_not_implemented_trial_number() -> None:
with StorageSupplier("inmemory") as storage:

with patch.object(
storage,
"get_trial_id_from_study_id_trial_number",
side_effect=NotImplementedError,
):
study = create_study(storage=storage)

study.tell(study.ask(), 1.0)

# Storage missing implementation for method required to map trial numbers back to
# trial IDs.
with pytest.warns(UserWarning):
study.tell(study.ask().number, 1.0)

with pytest.raises(ValueError):
study.tell(study.ask().number + 1, 1.0)
study = create_study(storage=storage)
study.tell(study.ask(), 1.0)
study.tell(study.ask().number, 1.0)

with pytest.raises(ValueError):
study.tell(study.ask().number + 1, 1.0)


@pytest.mark.parametrize("storage_mode", STORAGE_MODES)
Expand Down

0 comments on commit ce674ac

Please sign in to comment.