From 51cb6b6acadbbfc45aa281f84400ff982677c8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Thu, 11 Jul 2013 20:22:38 +0200 Subject: add test for JsonPointer.contains(other) --- tests.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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): -- cgit v1.2.1