def test_yaml_valasp_not_predicate(): yaml_input = """ wrap: - a a """ with pytest.raises(ValueError): YamlValidation.validate_valasp(yaml.safe_load(yaml_input))
def test_yaml_valasp_wrap_not_list(): for i in ['a', 1, {'a': 1}]: yaml_input = """ wrap: %s """ % i with pytest.raises(ValueError): YamlValidation.validate_valasp(yaml.safe_load(yaml_input))
def test_yaml_valasp_max_arity_wrong_types(): for i in ['a', -1, 100, {'a': 1}, [1]]: yaml_input = """ max_arity: %s """ % i with pytest.raises(ValueError): YamlValidation.validate_valasp(yaml.safe_load(yaml_input))
def test_yaml_valasp_python_wrong_type(): yaml_input = """ python: - something - here asp: |+ a(X) :- b(X). """ with pytest.raises(ValueError): YamlValidation.validate_valasp(yaml.safe_load(yaml_input))
def test_yaml_valasp_wrong_keyword(): yaml_input = """ python: |+ for i in range(10): print(i) ASP: |+ code """ with pytest.raises(ValueError): YamlValidation.validate_valasp(yaml.safe_load(yaml_input))
def test_yaml_valasp_asp_wrong_type(): yaml_input = """ python: |+ for i in range(10): print(i) asp: something: here """ with pytest.raises(ValueError): YamlValidation.validate_valasp(yaml.safe_load(yaml_input))
def test_yaml_valasp(): yaml_input = """ python: |+ for i in range(10): print(i) asp: |+ code wrap: - a - B - lower - Upper max_arity: 10 """ YamlValidation.validate_valasp(yaml.safe_load(yaml_input))