summaryrefslogtreecommitdiff
path: root/Lib/test/test_cgi.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-04-25 20:49:19 -0400
committerBrett Cannon <brett@python.org>2012-04-25 20:49:19 -0400
commit8f79dd5d7cc3eb19d568f8e95f04ee33f1177d92 (patch)
treefa91f171ffe0488222e91350ee4dc8d07ae08ea1 /Lib/test/test_cgi.py
parentf96bb2f9af24695d2d673b0044e25cb5b767aac0 (diff)
downloadcpython-git-8f79dd5d7cc3eb19d568f8e95f04ee33f1177d92.tar.gz
Silence DeprecationWarning for cgi.escape() usage in test_cgi.
Diffstat (limited to 'Lib/test/test_cgi.py')
-rw-r--r--Lib/test/test_cgi.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index d2510a40f2..5510a0dccd 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -4,6 +4,7 @@ import os
import sys
import tempfile
import unittest
+import warnings
from io import StringIO, BytesIO
class HackedSysModule:
@@ -119,9 +120,13 @@ def gen_result(data, environ):
class CgiTests(unittest.TestCase):
def test_escape(self):
- self.assertEqual("test &amp; string", cgi.escape("test & string"))
- self.assertEqual("&lt;test string&gt;", cgi.escape("<test string>"))
- self.assertEqual("&quot;test string&quot;", cgi.escape('"test string"', True))
+ # cgi.escape() is deprecated.
+ with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', 'cgi\.escape',
+ DeprecationWarning)
+ self.assertEqual("test &amp; string", cgi.escape("test & string"))
+ self.assertEqual("&lt;test string&gt;", cgi.escape("<test string>"))
+ self.assertEqual("&quot;test string&quot;", cgi.escape('"test string"', True))
def test_strict(self):
for orig, expect in parse_strict_test_cases: