summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkafkaf- <thekafkaf@gmail.com>2014-11-14 16:05:00 +0200
committerkafkaf- <thekafkaf@gmail.com>2014-11-14 16:05:00 +0200
commitec26151db15c241e29c7730dc12657434370ff67 (patch)
tree7bd311cb3b7ec9a2b1459d63bdb580133bb23937
parent4dc82340e04f1f445e072952ec03a3e9f544bc66 (diff)
downloadpython-json-pointer-ec26151db15c241e29c7730dc12657434370ff67.tar.gz
Removed unrelated changes to the contains method, reverted the exception handle
-rw-r--r--jsonpointer.py5
-rwxr-xr-xtests.py1
2 files changed, 2 insertions, 4 deletions
diff --git a/jsonpointer.py b/jsonpointer.py
index 02aa594..b3f0362 100644
--- a/jsonpointer.py
+++ b/jsonpointer.py
@@ -166,8 +166,7 @@ class JsonPointer(object):
try:
doc = self.walk(doc, part)
- # Catching a broad exception to ensure the return of the default
- except:
+ except JsonPointerException:
if default is _nothing:
raise
else:
@@ -250,7 +249,7 @@ class JsonPointer(object):
def contains(self, ptr):
""" Returns True if self contains the given ptr """
- return len(self.parts) >= len(ptr.parts) and \
+ return len(self.parts) > len(ptr.parts) and \
self.parts[:len(ptr.parts)] == ptr.parts
@property
diff --git a/tests.py b/tests.py
index db9c1c7..cc81dc6 100755
--- a/tests.py
+++ b/tests.py
@@ -96,7 +96,6 @@ class ComparisonTests(unittest.TestCase):
p3 = JsonPointer("/b/c")
self.assertTrue(p1.contains(p2))
- self.assertTrue(p1.contains(p1))
self.assertFalse(p1.contains(p3))