Show More
@@ -27,10 +27,12 b' def _string_escape(text):' | |||||
27 |
|
27 | |||
28 | def decodeextra(text): |
|
28 | def decodeextra(text): | |
29 | """ |
|
29 | """ | |
30 | >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'})) |
|
30 | >>> from pprint import pprint as pp | |
31 | {'foo': 'bar', 'baz': '\\x002', 'branch': 'default'} |
|
31 | >>> pp(decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'}))) | |
32 | >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(92) + chr(0) + '2'})) |
|
32 | {'baz': '\\x002', 'branch': 'default', 'foo': 'bar'} | |
33 | {'foo': 'bar', 'baz': '\\\\\\x002', 'branch': 'default'} |
|
33 | >>> pp(decodeextra(encodeextra({'foo': 'bar', | |
|
34 | ... 'baz': chr(92) + chr(0) + '2'}))) | |||
|
35 | {'baz': '\\\\\\x002', 'branch': 'default', 'foo': 'bar'} | |||
34 | """ |
|
36 | """ | |
35 | extra = _defaultextra.copy() |
|
37 | extra = _defaultextra.copy() | |
36 | for l in text.split('\0'): |
|
38 | for l in text.split('\0'): |
@@ -80,8 +80,8 b' def tolocal(s):' | |||||
80 | 'foo: \\xc3\\xa4' |
|
80 | 'foo: \\xc3\\xa4' | |
81 | >>> u2 = 'foo: \\xc3\\xa1' |
|
81 | >>> u2 = 'foo: \\xc3\\xa1' | |
82 | >>> d = { l: 1, tolocal(u2): 2 } |
|
82 | >>> d = { l: 1, tolocal(u2): 2 } | |
83 | >>> d # no collision |
|
83 | >>> len(d) # no collision | |
84 | {'foo: ?': 1, 'foo: ?': 2} |
|
84 | 2 | |
85 | >>> 'foo: ?' in d |
|
85 | >>> 'foo: ?' in d | |
86 | False |
|
86 | False | |
87 | >>> l1 = 'foo: \\xe4' # historical latin1 fallback |
|
87 | >>> l1 = 'foo: \\xe4' # historical latin1 fallback |
General Comments 0
You need to be logged in to leave comments.
Login now