Example #1
0
    def test__check_matrix_symmetric_positive_definite_np_error(self):
        """Test check matrix numpy raise error"""
        # Setup
        sampler = Mock(spec=Sampler)

        # Run
        matrix = np.array([[-1, 0], [0, 0]])
        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler, matrix)

        # Asserts
        assert not result
Example #2
0
    def test__check_matrix_symmetric_positive_definite(self):
        """Test check matrix numpy"""
        # Setup
        sampler = Mock(spec=Sampler)

        # Run
        matrix = np.array([[0.5, 0.5], [0.5, 0.5]])
        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler, matrix)

        # Asserts
        assert result
Example #3
0
    def test__check_matrix_symmetric_positive_definite_shape_error(self):
        """Test check matrix shape error"""
        # Setup
        sampler = Mock(spec=Sampler)

        # Run
        matrix = np.array([])
        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler, matrix)

        # Asserts
        assert not result
Example #4
0
    def test__check_matrix_symmetric_positive_definite(self):
        """Test check matrix numpy"""
        # Run
        sampler = Mock()
        matrix = np.array([[0.5, 0.5], [0.5, 0.5]])

        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler, matrix)

        # Asserts
        expected = True

        assert result is expected
Example #5
0
    def test__check_matrix_symmetric_positive_definite_np_error(self):
        """Test check matrix numpy raise error"""
        # Run
        sampler = Mock()
        matrix = np.array([[-1, 0], [0, 0]])

        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler, matrix)

        # Asserts
        expected = False

        assert result == expected
Example #6
0
    def test__check_matrix_symmetric_positive_definite_shape_error(self):
        """Test check matrix shape error"""
        # Run
        sampler = Mock()
        matrix = np.array([])

        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler, matrix)

        # Asserts
        expected = False

        assert result == expected
Example #7
0
    def test__check_matrix_symmetric_positive_definite_error(self):
        """Check matrix symmetric positive return false raise error"""

        # Setup

        # Run
        sampler_mock = Mock()

        matrix = np.array([[1, 1], [1, 1]])

        result = Sampler._check_matrix_symmetric_positive_definite(
            sampler_mock, matrix)

        # Asserts

        assert result is False