2eca0af3d781ec00cadbbda624218b2a8c508fa8,tests/storages_tests/test_storages.py,,test_get_study_id_from_name_and_get_study_name_from_id,#Any#,115

Before Change


def test_get_study_id_from_name_and_get_study_name_from_id(storage_init_func):
    // type: (Callable[[], BaseStorage]) -> None

    storage = storage_init_func()

    // Test not existing study.
    with pytest.raises(ValueError):
        storage.get_study_id_from_name("dummy-uuid")

    with pytest.raises(ValueError):
        storage.get_study_name_from_id(-1)

    study_name = "sample_study_name"
    // Test existing study.
    study_id = storage.create_new_study_id(study_name)
    summary = storage.get_all_study_summaries()[0]

    assert study_id == summary.study_id
    assert storage.get_study_name_from_id(summary.study_id) == summary.study_name
    assert storage.get_study_id_from_name(summary.study_name) == summary.study_id

After Change


def test_get_study_id_from_name_and_get_study_name_from_id(storage_mode):
    // type: (str) -> None

    with StorageSupplier(storage_mode) as storage:

        // Add storage_mode to avoid duplication of study_name.
        study_name = "sample_study_name_for_" + storage_mode
        study = pfnopt.create_study(storage=storage, study_name=study_name)

        // Test existing study.
        assert study.storage.get_study_name_from_id(study.study_id) == study_name
        assert study.storage.get_study_id_from_name(study_name) == study.study_id

        // Test not existing study.
        with pytest.raises(ValueError):
            study.storage.get_study_id_from_name("dummy-name")

        with pytest.raises(ValueError):
            study.storage.get_study_name_from_id(-1)


@parametrize_storage
def test_set_and_get_study_task(storage_init_func):
    // type: (Callable[[], BaseStorage]) -> None
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: pfnet/optuna
Commit Name: 2eca0af3d781ec00cadbbda624218b2a8c508fa8
Time: 2018-08-21
Author: toshihiko.yanase@gmail.com
File Name: tests/storages_tests/test_storages.py
Class Name:
Method Name: test_get_study_id_from_name_and_get_study_name_from_id


Project Name: pfnet/optuna
Commit Name: dab306150cbb847b3824452376f6ab0395f9cd09
Time: 2018-08-23
Author: toshihiko.yanase@gmail.com
File Name: tests/storages_tests/test_storages.py
Class Name:
Method Name: test_create_new_study_id_with_name


Project Name: pfnet/optuna
Commit Name: 754642db5ff35be98e4b6fc3a17823482881cb27
Time: 2020-04-29
Author: ytsmiling@gmail.com
File Name: tests/storages_tests/test_storages.py
Class Name:
Method Name: test_set_and_get_study_system_attrs


Project Name: pfnet/optuna
Commit Name: 280c4fb338bbb4cc967adfcc9714f05a606c6acf
Time: 2020-04-29
Author: ytsmiling@gmail.com
File Name: tests/storages_tests/test_storages.py
Class Name:
Method Name: test_set_and_get_study_system_attrs