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)'
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)'
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)")
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)"
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)"
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))"
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)"
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))'