예제 #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_)
예제 #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()
예제 #3
0
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)
예제 #4
0
def test_booth_dim_fail(outdim):
    """Test booth dim exception"""
    with pytest.raises(IndexError):
        fx.booth_func(outdim)
예제 #5
0
 def test_booth_output_size(self):
     """Test booth output size."""
     self.assertEqual(fx.booth_func(self.input).shape, self.target_size)
예제 #6
0
 def test_booth_output(self):
     """Test booth function output."""
     assert np.isclose(fx.booth_func([1, 3] * self.input2),
         self.target).all()
예제 #7
0
 def test_booth_dim_fail(self):
     """Test booth dim exception"""
     with self.assertRaises(IndexError):
         fx.booth_func(self.bad_input)
예제 #8
0
def test_booth_output_size(common_minima, targetdim):
    """Test booth output size."""
    assert fx.booth_func(common_minima).shape == targetdim