コード例 #1
0
    def test_get_prior_string_default_values(self, monkeypatch):
        """Test that default_value are included."""
        def contains(self, value):
            return True

        monkeypatch.setattr(Dimension, '__contains__', contains)
        dim = Dimension('yolo', 'alpha', 1, 2, default_value=1)
        assert dim.get_prior_string() == 'alpha(1, 2, default_value=1)'
コード例 #2
0
 def test_get_prior_string(self):
     """Test that prior string can be rebuilt."""
     dim = Dimension('yolo',
                     'alpha',
                     1,
                     2,
                     3,
                     some='args',
                     plus='fluff',
                     n=4)
     assert dim.get_prior_string(
     ) == 'alpha(1, 2, 3, some=\'args\', plus=\'fluff\', n=4)'
コード例 #3
0
ファイル: test_space.py プロジェクト: obilaniu/orion
 def test_get_prior_string(self):
     """Test that prior string can be rebuilt."""
     dim = Dimension("yolo",
                     "alpha",
                     1,
                     2,
                     3,
                     some="args",
                     plus="fluff",
                     n=4)
     assert (dim.get_prior_string() ==
             "alpha(1, 2, 3, some='args', plus='fluff', n=4)")
コード例 #4
0
ファイル: test_space.py プロジェクト: breuleux/orion
 def test_get_prior_string_normal(self):
     """Test that special norm prior name is replaced properly."""
     dim = Dimension("yolo", "norm", 1e-10, 1)
     assert dim.get_prior_string() == "normal(1e-10, 1)"
コード例 #5
0
ファイル: test_space.py プロジェクト: breuleux/orion
 def test_get_prior_string_loguniform(self):
     """Test that special loguniform prior name is replaced properly."""
     dim = Dimension("yolo", "reciprocal", 1e-10, 1)
     assert dim.get_prior_string() == "loguniform(1e-10, 1)"
コード例 #6
0
ファイル: test_space.py プロジェクト: breuleux/orion
 def test_get_prior_string_shape(self):
     """Test that shape is included."""
     dim = Dimension("yolo", "alpha", 1, 2, shape=(2, 3))
     assert dim.get_prior_string() == "alpha(1, 2, shape=(2, 3))"
コード例 #7
0
ファイル: test_space.py プロジェクト: breuleux/orion
 def test_get_prior_string_uniform(self):
     """Test special uniform args are handled properly."""
     dim = Dimension("yolo", "uniform", 1, 2)
     assert dim.get_prior_string() == "uniform(1, 3)"
コード例 #8
0
 def test_get_prior_string_shape(self):
     """Test that shape is included."""
     dim = Dimension('yolo', 'alpha', 1, 2, shape=(2, 3))
     assert dim.get_prior_string() == 'alpha(1, 2, shape=(2, 3))'