diff options
author | Stefan Kögl <stefan@skoegl.net> | 2013-07-11 20:22:38 +0200 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2013-07-11 20:22:38 +0200 |
commit | 51cb6b6acadbbfc45aa281f84400ff982677c8a3 (patch) | |
tree | b951a5d060a0bb11deaa86c529ef1cc2fa912cff /tests.py | |
parent | 8b2c8fe52803be008fc5f16ef5a4ebbebbc6482b (diff) | |
download | python-json-pointer-51cb6b6acadbbfc45aa281f84400ff982677c8a3.tar.gz |
add test for JsonPointer.contains(other)
Diffstat (limited to 'tests.py')
-rwxr-xr-x | tests.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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): |