[desc] Choice: cast input value to expected type when validating value

This commit is contained in:
Yann Lanthony 2017-11-08 18:20:05 +01:00
parent 8539c2817b
commit ccaac43b34

View file

@ -154,6 +154,8 @@ class ChoiceParam(Param):
raise ValueError('Non exclusive ChoiceParam value "{}" should be iterable.'.format(value))
newValues = value
for newValue in newValues:
t = type(self._values[0]) # cast to value type
newValue = t(newValue)
if newValue not in self.values:
raise ValueError('ChoiceParam value "{}" is not in "{}".'.format(newValue, str(self.values)))
return value