mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
#2830: add html.escape() helper and move cgi.escape() uses in the standard library to it. It defaults to quote=True and also escapes single quotes, which makes casual use safer. The cgi.escape() interface is not touched, but emits a (silent) PendingDeprecationWarning.
This commit is contained in:
parent
70543acfa1
commit
1f7fffb308
11 changed files with 94 additions and 28 deletions
|
@ -568,8 +568,8 @@ class Test_touch_import(support.TestCase):
|
|||
|
||||
def test_from_import(self):
|
||||
node = parse('bar()')
|
||||
fixer_util.touch_import("cgi", "escape", node)
|
||||
self.assertEqual(str(node), 'from cgi import escape\nbar()\n\n')
|
||||
fixer_util.touch_import("html", "escape", node)
|
||||
self.assertEqual(str(node), 'from html import escape\nbar()\n\n')
|
||||
|
||||
def test_name_import(self):
|
||||
node = parse('bar()')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue