Ejemplo n.º 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)'
Ejemplo n.º 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)'
Ejemplo n.º 3
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)")
Ejemplo n.º 4
0
 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)"
Ejemplo n.º 5
0
 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)"
Ejemplo n.º 6
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))"
Ejemplo n.º 7
0
 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)"
Ejemplo n.º 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))'