Esempio n. 1
0
    def test_booth_bound_fail(self):
        """Test booth bound exception"""
        x = - np.random.uniform(low=11.00001,high=100,size=(3,2))
        x_ = np.random.uniform(low=11.00001,high=100,size=(3,2))

        with self.assertRaises(ValueError):
            fx.booth_func(x)
        with self.assertRaises(ValueError):
            fx.booth_func(x_)
Esempio n. 2
0
def test_booth_output(common_minima2):
    """Test booth function output."""
    assert np.isclose(fx.booth_func([1, 3] * common_minima2),
                      np.zeros(3)).all()
def test_booth_bound_fail(outbound):
    """Test booth bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["booth"].low, b["booth"].high, size=(3, 2))
        fx.booth_func(x)
Esempio n. 4
0
def test_booth_dim_fail(outdim):
    """Test booth dim exception"""
    with pytest.raises(IndexError):
        fx.booth_func(outdim)
Esempio n. 5
0
 def test_booth_output_size(self):
     """Test booth output size."""
     self.assertEqual(fx.booth_func(self.input).shape, self.target_size)
Esempio n. 6
0
 def test_booth_output(self):
     """Test booth function output."""
     assert np.isclose(fx.booth_func([1, 3] * self.input2),
         self.target).all()
Esempio n. 7
0
 def test_booth_dim_fail(self):
     """Test booth dim exception"""
     with self.assertRaises(IndexError):
         fx.booth_func(self.bad_input)
Esempio n. 8
0
def test_booth_output_size(common_minima, targetdim):
    """Test booth output size."""
    assert fx.booth_func(common_minima).shape == targetdim