summaryrefslogtreecommitdiff
path: root/jsonschema/_utils.py
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2019-08-01 08:40:53 -0400
committerJulian Berman <Julian@GrayVines.com>2019-08-01 08:40:53 -0400
commit159894032c5bbb071fc46681083350488b53269a (patch)
treeb512baee2dac04531ec2d92587e9ea274ba0d262 /jsonschema/_utils.py
parent584c72ac948eaa7191f6252a075685e32959909c (diff)
downloadjsonschema-159894032c5bbb071fc46681083350488b53269a.tar.gz
Unskip and fix the const-related compare bug.
Refs: #575
Diffstat (limited to 'jsonschema/_utils.py')
-rw-r--r--jsonschema/_utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/jsonschema/_utils.py b/jsonschema/_utils.py
index 76ae6f5..79c2bc9 100644
--- a/jsonschema/_utils.py
+++ b/jsonschema/_utils.py
@@ -175,10 +175,16 @@ def ensure_list(thing):
return thing
+def equal(one, two):
+ """
+ Check if two things are equal, but evade booleans and ints being equal.
+ """
+ return unbool(one) == unbool(two)
+
+
def unbool(element, true=object(), false=object()):
"""
A hack to make True and 1 and False and 0 unique for ``uniq``.
-
"""
if element is True:
@@ -195,7 +201,6 @@ def uniq(container):
Successively tries first to rely that the elements are hashable, then
falls back on them being sortable, and finally falls back on brute
force.
-
"""
try: