mirror of https://github.com/python/cpython
Silence DeprecationWarning for cgi.escape() usage in test_cgi.
This commit is contained in:
parent
f96bb2f9af
commit
8f79dd5d7c
|
@ -4,6 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
import warnings
|
||||||
from io import StringIO, BytesIO
|
from io import StringIO, BytesIO
|
||||||
|
|
||||||
class HackedSysModule:
|
class HackedSysModule:
|
||||||
|
@ -119,9 +120,13 @@ def gen_result(data, environ):
|
||||||
class CgiTests(unittest.TestCase):
|
class CgiTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_escape(self):
|
def test_escape(self):
|
||||||
self.assertEqual("test & string", cgi.escape("test & string"))
|
# cgi.escape() is deprecated.
|
||||||
self.assertEqual("<test string>", cgi.escape("<test string>"))
|
with warnings.catch_warnings():
|
||||||
self.assertEqual(""test string"", cgi.escape('"test string"', True))
|
warnings.filterwarnings('ignore', 'cgi\.escape',
|
||||||
|
DeprecationWarning)
|
||||||
|
self.assertEqual("test & string", cgi.escape("test & string"))
|
||||||
|
self.assertEqual("<test string>", cgi.escape("<test string>"))
|
||||||
|
self.assertEqual(""test string"", cgi.escape('"test string"', True))
|
||||||
|
|
||||||
def test_strict(self):
|
def test_strict(self):
|
||||||
for orig, expect in parse_strict_test_cases:
|
for orig, expect in parse_strict_test_cases:
|
||||||
|
|
Loading…
Reference in New Issue