From 8b2c8fe52803be008fc5f16ef5a4ebbebbc6482b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Thu, 11 Jul 2013 18:37:53 +0200 Subject: add test for invalid list index --- tests.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.1