def test_complex_file_validation_invalid(self): schema_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), '../data/validator_tests/bids_schema.mediawiki') events_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../data/validator_tests/bids_events.tsv') hed_schema = schema.load_schema(schema_path) json_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "../data/validator_tests/bids_events_bad_defs.json") validator = HedValidator(hed_schema=hed_schema) sidecar = Sidecar(json_path) issues = sidecar.validate_entries(validators=validator, check_for_warnings=True) self.assertEqual(len(issues), 4) input_file = EventsInput(events_path, sidecars=sidecar) validation_issues = input_file.validate_file_sidecars( validator, check_for_warnings=True) self.assertEqual(len(validation_issues), 4) validation_issues = input_file.validate_file(validator, check_for_warnings=True) self.assertEqual(len(validation_issues), 42)
def test_complex_file_validation_invalid_definitions_removed(self): # This verifies definitions are being removed from sidecar strings before being added, or it will produce # extra errors. schema_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), '../data/validator_tests/bids_schema.mediawiki') events_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../data/validator_tests/bids_events.tsv') hed_schema = schema.load_schema(schema_path) json_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "../data/validator_tests/bids_events_bad_defs2.json") sidecar = Sidecar(json_path) input_file = EventsInput(events_path, sidecars=sidecar) validator = HedValidator(hed_schema=hed_schema) validation_issues1 = input_file.validate_file_sidecars(validator) self.assertEqual(len(validation_issues1), 4) validation_issues = input_file.validate_file(validator) self.assertEqual(len(validation_issues), 42)