Skip to content

Commit aac5318

Browse files
committed
error messages simplified #81
1 parent c7aee9e commit aac5318

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

src/dosdp/validator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_jschema(validator, pattern):
2727
if not validator.is_valid(pattern):
2828
es = validator.iter_errors(pattern)
2929
for e in es:
30-
warnings.warn(" => ".join([str(e.schema_path), str(e.message), str(e.context)]))
30+
warnings.warn(str(e.message))
3131
is_valid = False
3232

3333
return is_valid
@@ -262,7 +262,8 @@ def validate(pattern):
262262

263263
stat = True
264264
for pattern_doc in pattern_docs:
265-
logging.info("Checking %s" % pattern_doc)
265+
if len(pattern_docs) > 1:
266+
logging.info("Checking %s" % pattern_doc)
266267
with open(pattern_doc, "r") as stream:
267268
try:
268269
pattern = ryaml.load(stream)

src/schema/test/generic_test/validator_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"../negative_test_set/multi_clause_with_multi_list2.yaml")
3131
NEGATIVE_PATTERN_UNDECLARED_ANNOT_PROP = os.path.join(os.path.dirname(os.path.realpath(__file__)),
3232
"../negative_test_set/undeclared_annotation_prop.yaml")
33+
NEGATIVE_PATTERN_SCHEMA = os.path.join(os.path.dirname(os.path.realpath(__file__)),
34+
"../negative_test_set/not_schema_compliant.yaml")
3335

3436

3537
class ValidatorTest(unittest.TestCase):
@@ -65,3 +67,6 @@ def test_single_list_per_multi_clause(self):
6567

6668
def test_undeclared_annotation_prop(self):
6769
self.assertFalse(validate(NEGATIVE_PATTERN_UNDECLARED_ANNOT_PROP))
70+
71+
def test_schema_validation(self):
72+
self.assertFalse(validate(NEGATIVE_PATTERN_SCHEMA))
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
pattern_name: acute
2+
3+
pattern_iri: http://purl.obolibrary.org/obo/mondo/patterns/acute.yaml
4+
5+
description: 'This pattern is applied to diseases that are described as having an acute onset, i.e. the sudden appearance of disease manifestations over a short period of time.
6+
7+
Examples: [acute bronchiolitis](http://purl.obolibrary.org/obo/MONDO_0020680),
8+
[acute liver failure](http://purl.obolibrary.org/obo/MONDO_0019542)'
9+
10+
contributors:
11+
- https://orcid.org/0000-0002-6601-2165
12+
- https://orcid.org/0000-0001-5208-3432
13+
14+
classes:
15+
acute: PATO:0000389
16+
disease: MONDO:0000001
17+
18+
relations:
19+
has modifier: RO:0002573
20+
21+
annotationProperties:
22+
exact_synonym: oio:hasExactSynonym
23+
related_synonym: oio:hasRelatedSynonym
24+
25+
vars:
26+
disease: '''disease'''
27+
28+
name:
29+
text: acute %s
30+
vars:
31+
- disease
32+
33+
# axioms is not valid
34+
axioms:
35+
- annotationProperty: exact_synonym
36+
text: '%s, acute'
37+
vars:
38+
- disease
39+
40+
annotations:
41+
# property is not valid
42+
- property: exact_synonym
43+
text: '%s, acute'
44+
vars:
45+
- disease
46+
47+
def:
48+
text: Acute form of %s.
49+
vars:
50+
- disease
51+
52+
equivalentTo:
53+
text: '%s and ''has modifier'' some ''acute'''
54+
vars:
55+
- disease

0 commit comments

Comments
 (0)