summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmaillol-altair <55581329+vmaillol-altair@users.noreply.github.com>2020-11-18 20:13:54 +0100
committerGitHub <noreply@github.com>2020-11-18 20:13:54 +0100
commitffa09b4b0668fdc7dba012d8c13ffb35bc83ff79 (patch)
tree9ec35f13271e522bdf42c62186533622ce023c3a
parent67adedd627054e151101575c8c5a7d65f72f827a (diff)
downloadvoluptuous-ffa09b4b0668fdc7dba012d8c13ffb35bc83ff79.tar.gz
Improve error message for In() and NotIn() (#425)
* Update validators.py * Update In and NotIn validator error message
-rw-r--r--voluptuous/validators.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/voluptuous/validators.py b/voluptuous/validators.py
index 2add5d1..fd0aa90 100644
--- a/voluptuous/validators.py
+++ b/voluptuous/validators.py
@@ -737,7 +737,8 @@ class In(object):
except TypeError:
check = True
if check:
- raise InInvalid(self.msg or 'value is not allowed')
+ raise InInvalid(self.msg or
+ 'value must be one of {}'.format(self.container))
return v
def __repr__(self):
@@ -757,7 +758,8 @@ class NotIn(object):
except TypeError:
check = True
if check:
- raise NotInInvalid(self.msg or 'value is not allowed')
+ raise NotInInvalid(self.msg or
+ 'value must not be one of {}'.format(self.container))
return v
def __repr__(self):