Skip to content

Commit

Permalink
Merge pull request #1048 from VisLab/develop
Browse files Browse the repository at this point in the history
Fixed exception when {x} is used and x has no HED
  • Loading branch information
VisLab authored Feb 7, 2025
2 parents 6819287 + 0af4984 commit 2f5c209
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hed/validator/sidecar_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def _validate_refs(self, sidecar, error_handler):
found_column_references = {}
for column_data in sidecar:
column_name = column_data.column_name
if column_data.column_type == ColumnType.Ignore:
continue
hed_strings = column_data.get_hed_strings()
error_handler.push_error_context(ErrorContext.SIDECAR_COLUMN_NAME, column_name)
matches = []
Expand Down Expand Up @@ -183,7 +185,6 @@ def _validate_refs(self, sidecar, error_handler):
for ref in refs:
if ref in found_column_references and ref != column_name:
issues += error_handler.format_error_with_context(ColumnErrors.NESTED_COLUMN_REF, column_name, ref)

return issues

@staticmethod
Expand Down
16 changes: 16 additions & 0 deletions tests/validator/test_sidecar_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ def test_bad_pound_signs(self):
issues = sidecar.validate(self.hed_schema)
self.assertEqual(len(issues), 3)

def test_missing_hed(self):
sidecar_with_hed_missing = '''
{
"event_code": {
"HED": {
"face": "Statistical-accuracy/0.677, {response}"
}
},
"response": "Label/#",
"other": "Description"
}
'''
sidecar = Sidecar(io.StringIO(sidecar_with_hed_missing))
issues = sidecar.validate(self.hed_schema)
self.assertEqual(len(issues), 1)

def test_invalid_list(self):
sidecar_json = '''
{
Expand Down

0 comments on commit 2f5c209

Please sign in to comment.