File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import sys
55import tempfile
66import unittest
7+ import warnings
78from io import StringIO , BytesIO
89
910class HackedSysModule :
@@ -119,9 +120,13 @@ def gen_result(data, environ):
119120class CgiTests (unittest .TestCase ):
120121
121122 def test_escape (self ):
122- self .assertEqual ("test & string" , cgi .escape ("test & string" ))
123- self .assertEqual ("<test string>" , cgi .escape ("<test string>" ))
124- self .assertEqual (""test string"" , cgi .escape ('"test string"' , True ))
123+ # cgi.escape() is deprecated.
124+ with warnings .catch_warnings ():
125+ warnings .filterwarnings ('ignore' , 'cgi\.escape' ,
126+ DeprecationWarning )
127+ self .assertEqual ("test & string" , cgi .escape ("test & string" ))
128+ self .assertEqual ("<test string>" , cgi .escape ("<test string>" ))
129+ self .assertEqual (""test string"" , cgi .escape ('"test string"' , True ))
125130
126131 def test_strict (self ):
127132 for orig , expect in parse_strict_test_cases :
You can’t perform that action at this time.
0 commit comments