mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906)
* Document that ensure_ascii=True forces escaping not only non-ASCII, but also non-printable characters (the only affected ASCII character is U+007F). * Ensure that the help output for the json module does not exceed 80 columns (except one long line in an example and generated lines). * Add more tests.
This commit is contained in:
parent
8cec3d3a9d
commit
7e90bac3cc
6 changed files with 89 additions and 43 deletions
|
|
@ -8,13 +8,12 @@
|
|||
('\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
|
||||
('controls', '"controls"'),
|
||||
('\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),
|
||||
('\x00\x1f\x7f', '"\\u0000\\u001f\\u007f"'),
|
||||
('{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'),
|
||||
(' s p a c e d ', '" s p a c e d "'),
|
||||
('\U0001d120', '"\\ud834\\udd20"'),
|
||||
('\u03b1\u03a9', '"\\u03b1\\u03a9"'),
|
||||
("`1~!@#$%^&*()_+-={':[,]}|;.</>?", '"`1~!@#$%^&*()_+-={\':[,]}|;.</>?"'),
|
||||
('\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),
|
||||
('\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
|
||||
]
|
||||
|
||||
class TestEncodeBasestringAscii:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue