File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,31 @@ def test_round_trip(self):
70
70
ptr = JsonPointer (path )
71
71
self .assertEqual (path , ptr .path )
72
72
73
- parts = ptr .parts
73
+ parts = ptr .get_parts ()
74
+ self .assertEqual (parts , ptr .parts )
74
75
new_ptr = JsonPointer .from_parts (parts )
75
76
self .assertEqual (ptr , new_ptr )
76
77
78
+ def test_parts (self ):
79
+ paths = [
80
+ ("" , []),
81
+ ("/foo" , ['foo' ]),
82
+ ("/foo/0" , ['foo' , '0' ]),
83
+ ("/" , ['' ]),
84
+ ("/a~1b" , ['a/b' ]),
85
+ ("/c%d" , ['c%d' ]),
86
+ ("/e^f" , ['e^f' ]),
87
+ ("/g|h" , ['g|h' ]),
88
+ ("/i\\ j" , ['i\j' ]),
89
+ ("/k\" l" , ['k"l' ]),
90
+ ("/ " , [' ' ]),
91
+ ("/m~0n" , ['m~n' ]),
92
+ ('/\xee ' , ['\xee ' ]),
93
+ ]
94
+ for path in paths :
95
+ ptr = JsonPointer (path [0 ])
96
+ self .assertEqual (ptr .get_parts (), path [1 ])
97
+
77
98
78
99
class ComparisonTests (unittest .TestCase ):
79
100
You can’t perform that action at this time.
0 commit comments