Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
# Unpack the parameter set fixture
good_params, bad_params, message = bad_parameter_sets
error_message = message + " should trigger a value error for var_process "+\
"parent-neighbour dictionary"
# Test the good parameter set
try:
pp._check_parent_neighbor(good_params)
covar = pp._get_covariance_matrix(good_params)
pp._check_symmetric_relations(covar)
# Ensure no exception is raised
except:
pytest.fail("Good parameter set triggers exception incorrectly!")
# Ensure an exception is raised for a bad parameter set
with pytest.raises(ValueError):
pp._check_parent_neighbor(bad_params)
covar = pp._get_covariance_matrix(bad_params)
pp._check_symmetric_relations(covar)
pytest.fail(error_message)
def test_bad_parameters(bad_parameter_sets):
"""
Test that the correct exceptions are raised for bad input connectivity
dictionaries
"""
# Unpack the parameter set fixture
good_params, bad_params, message = bad_parameter_sets
error_message = message + " should trigger a value error for var_process "+\
"parent-neighbour dictionary"
# Test the good parameter set
try:
pp._check_parent_neighbor(good_params)
covar = pp._get_covariance_matrix(good_params)
pp._check_symmetric_relations(covar)
# Ensure no exception is raised
except:
pytest.fail("Good parameter set triggers exception incorrectly!")
# Ensure an exception is raised for a bad parameter set
with pytest.raises(ValueError):
pp._check_parent_neighbor(bad_params)
covar = pp._get_covariance_matrix(bad_params)
pp._check_symmetric_relations(covar)
pytest.fail(error_message)