Skip to content

Commit c325e85

Browse files
committed
[property] Filter warnings on cardinality validate
When running a values cardinality validation filter the warnings to only those that are relevant for the validated object.
1 parent b248516 commit c325e85

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

odml/property.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,10 @@ def _values_cardinality_validation(self):
559559
is respected and prints a warning message otherwise.
560560
"""
561561
valid = validation.Validation(self)
562-
for err in valid.errors:
562+
563+
# Make sure to display only warnings of the current property
564+
res = [curr for curr in valid.errors if self.id == curr.obj.id]
565+
for err in res:
563566
print("%s: %s" % (err.rank.capitalize(), err.msg))
564567

565568
def set_values_cardinality(self, min_val=None, max_val=None):

0 commit comments

Comments
 (0)