mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-33843: Remove deprecated stuff in cgi module (GH-7662)
This commit is contained in:
parent
cb970730e3
commit
698865dcbb
5 changed files with 7 additions and 81 deletions
|
@ -4,7 +4,6 @@ import os
|
|||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import warnings
|
||||
from collections import namedtuple
|
||||
from io import StringIO, BytesIO
|
||||
from test import support
|
||||
|
@ -163,15 +162,6 @@ Content-Length: 3
|
|||
fs = cgi.FieldStorage(headers={'content-type':'text/plain'})
|
||||
self.assertRaises(TypeError, bool, fs)
|
||||
|
||||
def test_escape(self):
|
||||
# cgi.escape() is deprecated.
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('ignore', r'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):
|
||||
for orig, expect in parse_strict_test_cases:
|
||||
# Test basic parsing
|
||||
|
@ -449,20 +439,6 @@ this is the content of the fake file
|
|||
v = gen_result(data, environ)
|
||||
self.assertEqual(result, v)
|
||||
|
||||
def test_deprecated_parse_qs(self):
|
||||
# this func is moved to urllib.parse, this is just a sanity check
|
||||
with check_warnings(('cgi.parse_qs is deprecated, use urllib.parse.'
|
||||
'parse_qs instead', DeprecationWarning)):
|
||||
self.assertEqual({'a': ['A1'], 'B': ['B3'], 'b': ['B2']},
|
||||
cgi.parse_qs('a=A1&b=B2&B=B3'))
|
||||
|
||||
def test_deprecated_parse_qsl(self):
|
||||
# this func is moved to urllib.parse, this is just a sanity check
|
||||
with check_warnings(('cgi.parse_qsl is deprecated, use urllib.parse.'
|
||||
'parse_qsl instead', DeprecationWarning)):
|
||||
self.assertEqual([('a', 'A1'), ('b', 'B2'), ('B', 'B3')],
|
||||
cgi.parse_qsl('a=A1&b=B2&B=B3'))
|
||||
|
||||
def test_parse_header(self):
|
||||
self.assertEqual(
|
||||
cgi.parse_header("text/plain"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue