44be9703a0744caf78b8b61319be0db281e91d6a,skopt/tests/test_space.py,,test_space_from_yaml,#,488

Before Change



@pytest.mark.fast_test
def test_space_from_yaml():
    tmp_file = NamedTemporaryFile(delete=False)
    tmp_file_path = tmp_file.name
    tmp_file.write(b
      Space:
        - Real:
            low: 0.0
            high: 1.0
        - Integer:
            low: -5
            high: 5
        - Categorical:
            categories:
              - a
              - b
              - c
        - Real:
            low: 1.0
            high: 5.0
            prior: log-uniform
        - Categorical:
            categories:
              - e
              - f
    )
    tmp_file.close()

    space = Space([(0.0, 1.0), (-5, 5),
                   ("a", "b", "c"), (1.0, 5.0, "log-uniform"), ("e", "f")])

After Change



@pytest.mark.fast_test
def test_space_from_yaml():
    with NamedTemporaryFile() as tmp:
        tmp.write(b
        Space:
            - Real:
                low: 0.0
                high: 1.0
            - Integer:
                low: -5
                high: 5
            - Categorical:
                categories:
                - a
                - b
                - c
            - Real:
                low: 1.0
                high: 5.0
                prior: log-uniform
            - Categorical:
                categories:
                - e
                - f
        )
        tmp.flush()

        space = Space([(0.0, 1.0),
                       (-5, 5),
                       ("a", "b", "c"),
                       (1.0, 5.0, "log-uniform"),
                       ("e", "f")])

        space2 = Space.from_yaml(tmp.name)
        assert_equal(space, space2)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: scikit-optimize/scikit-optimize
Commit Name: 44be9703a0744caf78b8b61319be0db281e91d6a
Time: 2018-04-06
Author: scott_graham@bose.com
File Name: skopt/tests/test_space.py
Class Name:
Method Name: test_space_from_yaml


Project Name: floodsung/Deep-Learning-Papers-Reading-Roadmap
Commit Name: a44ce12889cde5ed30dc5a9e3ff952cf97f99e36
Time: 2017-07-04
Author: shreyaspadhy@gmail.com
File Name: download.py
Class Name:
Method Name: download_pdf


Project Name: Pinafore/qb
Commit Name: 3ada8bc8fb33a7ee25939328babd40ecb6137cf8
Time: 2017-05-12
Author: sjtufs@gmail.com
File Name: qanta/buzzer/hyper_search.py
Class Name:
Method Name: hyper_search