File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff 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 , [])
You can’t perform that action at this time.
0 commit comments