Skip to content

Commit 7a5fd79

Browse files
committed
[util] Handle exact val cardinality edge case
1 parent 5f10714 commit 7a5fd79

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

odml/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def format_cardinality(in_val):
4646
min_int = isinstance(v_min, int) and v_min >= 0
4747
max_int = isinstance(v_max, int) and v_max >= 0
4848

49-
if max_int and min_int and v_max > v_min:
49+
if max_int and min_int and v_max >= v_min:
5050
return v_min, v_max
5151

5252
if max_int and not v_min:

test/test_util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def test_format_cardinality(self):
3434
set_val = (2, 3)
3535
self.assertEqual(format_cardinality(set_val), set_val)
3636

37+
# Test exact value tuple set
38+
set_val = (5, 5)
39+
self.assertEqual(format_cardinality(set_val), set_val)
40+
3741
# Test set failures
3842
with self.assertRaises(ValueError):
3943
format_cardinality("a")

0 commit comments

Comments
 (0)