-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Speed/# degree/s passes validation with allow_placeholders=True, but
Speed/45.2 degree/s fails because degree/s is not a valid Speed unit.
Check the following script:
from hed import load_schema_version
from hed.models import HedString
schema = load_schema_version("8.4.0")
# Template with placeholder - PASSES (but shouldn't, since degree/s is invalid)
template = HedString("Speed/# degree/s", schema)
issues_template = template.validate(allow_placeholders=True)
assert issues_template == []
# Same template with value substituted - FAILS
expanded = HedString("Speed/45.2 degree/s", schema)
issues_expanded = expanded.validate(allow_placeholders=False)
print(issues_expanded)Output:
[{'code': 'UNITS_INVALID', 'message': 'Invalid unit - "Speed/45.2 degree/s" valid units are "kph,m-per-s,mph"', 'severity': 1, 'source_tag': <hed.models.hed_tag.HedTag object at 0x731f1fd078f0>}]I think that the unit error could be caught at template validation time as well, right?
I also tested this behavior here:
https://hedtools.org/hed/strings
If you tell me what repo covers this I can open an issue about it
Metadata
Metadata
Assignees
Labels
No labels