summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strptime.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2003-08-29 02:28:54 (GMT)
committerBrett Cannon <bcannon@gmail.com>2003-08-29 02:28:54 (GMT)
commit953c6f508b43bd7d4532aeb4644829122f80ae2a (patch)
tree05244772d60f8e4318ed78edc730199455d2f83c /Lib/test/test_strptime.py
parent6676f6edc11bd3e3e1559a76aab22c6af6faf14e (diff)
downloadcpython-953c6f508b43bd7d4532aeb4644829122f80ae2a.zip
cpython-953c6f508b43bd7d4532aeb4644829122f80ae2a.tar.gz
cpython-953c6f508b43bd7d4532aeb4644829122f80ae2a.tar.bz2
Make sure parentheses are escaped when used in the format string.
Closes bug #796149 . Will be backported.
Diffstat (limited to 'Lib/test/test_strptime.py')
-rw-r--r--Lib/test/test_strptime.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 76bfd63..4dcc82a 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -333,6 +333,15 @@ class StrptimeTests(unittest.TestCase):
"Default values for strptime() are incorrect;"
" %s != %s" % (strp_output, defaults))
+ def test_escaping(self):
+ # Make sure all characters that have regex significance are escaped.
+ # Parentheses are in a purposeful order; will cause an error of
+ # unbalanced parentheses when the regex is compiled if they are not
+ # escaped.
+ # Test instigated by bug #796149 .
+ need_escaping = ".^$*+?{}\[]|)("
+ self.failUnless(_strptime.strptime(need_escaping, need_escaping))
+
class Strptime12AMPMTests(unittest.TestCase):
"""Test a _strptime regression in '%I %p' at 12 noon (12 PM)"""