We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95a5b46 commit 1ed957bCopy full SHA for 1ed957b
tests.py
@@ -47,6 +47,28 @@ def test_eol(self):
47
self.assertTrue(isinstance(resolve_pointer(doc, "/foo/-"), EndOfList))
48
self.assertRaises(JsonPointerException, resolve_pointer, doc, "/foo/-/1")
49
50
+ def test_round_trip(self):
51
+ paths = [
52
+ "",
53
+ "/foo",
54
+ "/foo/0",
55
+ "/",
56
+ "/a~1b",
57
+ "/c%d",
58
+ "/e^f",
59
+ "/g|h",
60
+ "/i\\j",
61
+ "/k\"l",
62
+ "/ ",
63
+ "/m~0n",
64
+ ]
65
+ for path in paths:
66
+ ptr = JsonPointer(path)
67
+ self.assertEqual(path, ptr.path)
68
+
69
+ parts = ptr.parts
70
+ new_ptr = JsonPointer.from_parts(parts)
71
+ self.assertEqual(ptr, new_ptr)
72
73
class ComparisonTests(unittest.TestCase):
74
0 commit comments