Skip to content

Commit ca77e62

Browse files
committed
[validation.py] Add Check for Property Value Tuple Length
1 parent 5778db1 commit ca77e62

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

odml/validation.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,14 @@ def property_values_check(prop):
374374
return
375375

376376
for val in prop.values:
377-
try:
378-
dtypes.get(val, dtype)
379-
except ValueError:
380-
msg = "Property values not of consistent dtype!"
381-
yield ValidationError(prop, msg, LABEL_WARNING)
377+
if dtype.endswith("-tuple"):
378+
tuple_len = int(dtype[:-6])
379+
if len(val) != tuple_len:
380+
msg = "Tuple of length %s not consistent with dtype %s!" % (len(val), dtype)
381+
yield ValidationError(prop, msg, LABEL_WARNING)
382+
else:
383+
try:
384+
dtypes.get(val, dtype)
385+
except ValueError:
386+
msg = "Property values not of consistent dtype!"
387+
yield ValidationError(prop, msg, LABEL_WARNING)

0 commit comments

Comments
 (0)