Skip to content

Commit ff37562

Browse files
committed
[test/validation] Re-add sec repo present test
1 parent ef270d3 commit ff37562

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/test_validation.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,27 @@ def test_load_dtypes_yaml(self):
467467
path = os.path.join(RES_DIR, "validation_dtypes.yaml")
468468
doc = odml.load(path, "YAML")
469469
self.load_dtypes_validation(doc)
470+
471+
def test_section_in_terminology(self):
472+
"""
473+
Test optional section in terminology validation.
474+
"""
475+
doc = samplefile.parse("""s1[T1]""")
476+
477+
# Set up custom validation and add section_repository_present handler
478+
res = odml.validation.Validation(doc, validate=False, reset=True)
479+
handler = odml.validation.section_repository_present
480+
res.register_custom_handler('section', handler)
481+
482+
res.run_validation()
483+
self.assertError(res, "A section should have an associated repository",
484+
filter_rep=False)
485+
486+
odml.terminology.terminologies['map'] = samplefile.parse("""
487+
s0[t0]
488+
- S1[T1]
489+
""")
490+
doc.sections[0].repository = 'map'
491+
res = Validate(doc)
492+
# self.assertEqual(list(self.filter_mapping_errors(res.errors)), [])
493+
self.assertEqual(res.errors, [])

0 commit comments

Comments
 (0)