summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2013-07-11 20:22:38 +0200
committerStefan Kögl <stefan@skoegl.net>2013-07-11 20:22:38 +0200
commit51cb6b6acadbbfc45aa281f84400ff982677c8a3 (patch)
treeb951a5d060a0bb11deaa86c529ef1cc2fa912cff
parent8b2c8fe52803be008fc5f16ef5a4ebbebbc6482b (diff)
downloadpython-json-pointer-51cb6b6acadbbfc45aa281f84400ff982677c8a3.tar.gz
add test for JsonPointer.contains(other)
-rwxr-xr-xtests.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index 00c4dbd..9d4ca59 100755
--- a/tests.py
+++ b/tests.py
@@ -49,7 +49,7 @@ class SpecificationTests(unittest.TestCase):
class ComparisonTests(unittest.TestCase):
- def test_eq_hash(self):
+ def test_eq_hash(self):
p1 = JsonPointer("/something/1/b")
p2 = JsonPointer("/something/1/b")
p3 = JsonPointer("/something/1.0/b")
@@ -65,6 +65,15 @@ class ComparisonTests(unittest.TestCase):
# a pointer compares not-equal to objects of other types
self.assertFalse(p1 == "/something/1/b")
+ def test_contains(self):
+ p1 = JsonPointer("/a/b/c")
+ p2 = JsonPointer("/a/b")
+ p3 = JsonPointer("/b/c")
+
+ self.assertTrue(p1.contains(p2))
+ self.assertFalse(p1.contains(p3))
+
+
class WrongInputTests(unittest.TestCase):