summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2012-11-08 15:55:45 +0100
committerStefan Kögl <stefan@skoegl.net>2012-11-08 15:55:45 +0100
commit16d29f8fa10664a92f27b47d617260f0e5d13b9a (patch)
tree90aa95a21273e2d669a931130232f1f2e655f935 /tests.py
parent97a06ecb9dde82bd54dc269052841035ca2a1390 (diff)
downloadpython-json-pointer-16d29f8fa10664a92f27b47d617260f0e5d13b9a.tar.gz
update jsonpointer to current spec
http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-05
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']