File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -548,6 +548,7 @@ def val_cardinality(self, new_value):
548548 the maximum or an integer 2-tuple of the format '(min, max)'.
549549 """
550550 invalid_input = False
551+ exc_msg = "Can only assign positive single int or int-tuples of the format '(min, max)'"
551552
552553 # Empty values reset the cardinality to None.
553554 if not new_value or new_value == (None , None ):
@@ -576,6 +577,10 @@ def val_cardinality(self, new_value):
576577
577578 else :
578579 invalid_input = True
580+
581+ # Use helpful exception message in the following case:
582+ if max_int and min_int and v_max < v_min :
583+ exc_msg = "Minimum larger than maximum (min=%s, max=%s)" % (v_min , v_max )
579584 else :
580585 invalid_input = True
581586
@@ -585,8 +590,7 @@ def val_cardinality(self, new_value):
585590 for err in valid .errors :
586591 print ("%s: %s" % (err .rank .capitalize (), err .msg ))
587592 else :
588- msg = "Can only assign single int or int-tuples of the format '(min, max)'"
589- raise ValueError (msg )
593+ raise ValueError (exc_msg )
590594
591595 def set_values_cardinality (self , min_val = None , max_val = None ):
592596 """
You can’t perform that action at this time.
0 commit comments