summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index 57a4818..a0a2c79 100755
--- a/tests.py
+++ b/tests.py
@@ -4,7 +4,7 @@
import doctest
import unittest
import sys
-from jsonpointer import resolve_pointer
+from jsonpointer import resolve_pointer, EndOfList, JsonPointerException
class SpecificationTests(unittest.TestCase):
""" Tests all examples from the JSON Pointer specification """
@@ -37,6 +37,14 @@ class SpecificationTests(unittest.TestCase):
self.assertEqual(resolve_pointer(doc, "/m~0n"), 8)
+ def test_eol(self):
+ doc = {
+ "foo": ["bar", "baz"]
+ }
+
+ self.assertTrue(isinstance(resolve_pointer(doc, "/foo/-"), EndOfList))
+ self.assertRaises(JsonPointerException, resolve_pointer, doc, "/foo/-/1")
+
modules = ['jsonpointer']