summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2021-11-04 14:19:35 +0100
committerGitHub <noreply@github.com>2021-11-04 14:19:35 +0100
commit896102d605605ec0f48e26bafb54fb591be66ede (patch)
treebb1a5748d64791ee4370bcc78c715c6d095610f4 /tests.py
parent7d146bd7caf196bd04b44bdb6d395e91256fa88c (diff)
parenta5e9f91e59e54bf1889a7eb2bfb24539a281e181 (diff)
downloadpython-json-pointer-896102d605605ec0f48e26bafb54fb591be66ede.tar.gz
Merge pull request #46 from PeterlitsZo/patch-1
Add method and add classmethod tag
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index 54ca436..409990e 100755
--- a/tests.py
+++ b/tests.py
@@ -70,10 +70,31 @@ class SpecificationTests(unittest.TestCase):
ptr = JsonPointer(path)
self.assertEqual(path, ptr.path)
- parts = ptr.parts
+ parts = ptr.get_parts()
+ self.assertEqual(parts, ptr.parts)
new_ptr = JsonPointer.from_parts(parts)
self.assertEqual(ptr, new_ptr)
+ def test_parts(self):
+ paths = [
+ ("", []),
+ ("/foo", ['foo']),
+ ("/foo/0", ['foo', '0']),
+ ("/", ['']),
+ ("/a~1b", ['a/b']),
+ ("/c%d", ['c%d']),
+ ("/e^f", ['e^f']),
+ ("/g|h", ['g|h']),
+ ("/i\\j", ['i\j']),
+ ("/k\"l", ['k"l']),
+ ("/ ", [' ']),
+ ("/m~0n", ['m~n']),
+ ('/\xee', ['\xee']),
+ ]
+ for path in paths:
+ ptr = JsonPointer(path[0])
+ self.assertEqual(ptr.get_parts(), path[1])
+
class ComparisonTests(unittest.TestCase):