Skip to content

Commit

Permalink
add stricter type-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceBleukx committed May 21, 2024
1 parent 179f68b commit be5fe8b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpmpy/expressions/globalfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ class Among(GlobalFunction):
def __init__(self,arr,vals):
if not is_any_list(arr) or not is_any_list(vals):
raise TypeError("Among takes as input two arrays, not: {} and {}".format(arr,vals))
if any(isinstance(val, Expression) for val in vals):
raise TypeError(f"Among takes a set of values as input, not {vals}")
super().__init__("among", [arr,vals])

def decompose_comparison(self, cmp_op, cmp_rhs):
Expand Down

0 comments on commit be5fe8b

Please sign in to comment.