Skip to content

Commit

Permalink
enh(validators, python-jsonschema#675): compare enum with is (vs ==…
Browse files Browse the repository at this point in the history
…)...

 to evade failures due to overridden equals e.g. pandas.
 Patches changes of python-jsonschema#575.
  • Loading branch information
ankostis committed Apr 3, 2020
1 parent d2bc412 commit fcc21e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jsonschema/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def dependencies(validator, dependencies, instance, schema):


def enum(validator, enums, instance, schema):
if instance == 0 or instance == 1:
if instance is 0 or instance is 1:
unbooled = unbool(instance)
if all(unbooled != unbool(each) for each in enums):
yield ValidationError("%r is not one of %r" % (instance, enums))
Expand Down

0 comments on commit fcc21e0

Please sign in to comment.