summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2013-07-11 18:37:53 +0200
committerStefan Kögl <stefan@skoegl.net>2013-07-11 18:37:53 +0200
commit8b2c8fe52803be008fc5f16ef5a4ebbebbc6482b (patch)
tree30153589c12fbda5f3fd257b7b836eedc061b6dc
parentb531ce1db69df4e290fda445edc85b8f135526fa (diff)
downloadpython-json-pointer-8b2c8fe52803be008fc5f16ef5a4ebbebbc6482b.tar.gz
add test for invalid list index
-rwxr-xr-xtests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index eaecc14..00c4dbd 100755
--- a/tests.py
+++ b/tests.py
@@ -69,10 +69,15 @@ class ComparisonTests(unittest.TestCase):
class WrongInputTests(unittest.TestCase):
def test_no_start_slash(self):
-
# an exception is raised when the pointer string does not start with /
self.assertRaises(JsonPointerException, JsonPointer, 'some/thing')
+ def test_invalid_index(self):
+ # 'a' is not a valid list index
+ doc = [0, 1, 2]
+ self.assertRaises(JsonPointerException, resolve_pointer, doc, '/a')
+
+
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(SpecificationTests))