summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strptime.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2004-10-06 02:11:37 (GMT)
committerBrett Cannon <bcannon@gmail.com>2004-10-06 02:11:37 (GMT)
commit4f35c71543f5dc0023590676c21b18b1a3a5986f (patch)
tree64e2553be58da706224e0df4856e9d9156d4245b /Lib/test/test_strptime.py
parent579b3e2416cd403b634e2b41a946719630679fbc (diff)
downloadcpython-4f35c71543f5dc0023590676c21b18b1a3a5986f.zip
cpython-4f35c71543f5dc0023590676c21b18b1a3a5986f.tar.gz
cpython-4f35c71543f5dc0023590676c21b18b1a3a5986f.tar.bz2
Locale data that contains regex metacharacters are now properly escaped.
Closes bug #1039270.
Diffstat (limited to 'Lib/test/test_strptime.py')
-rw-r--r--Lib/test/test_strptime.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 5aaa9a7..17f339b 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -176,6 +176,19 @@ class TimeRETests(unittest.TestCase):
found = compiled_re.match("\w+ 10")
self.failUnless(found, "Escaping failed of format '\w+ 10'")
+ def test_locale_data_w_regex_metacharacters(self):
+ # Check that if locale data contains regex metacharacters they are
+ # escaped properly.
+ # Discovered by bug #1039270 .
+ locale_time = _strptime.LocaleTime()
+ locale_time.timezone = (frozenset(("utc", "gmt",
+ "Tokyo (standard time)")),
+ frozenset("Tokyo (daylight time)"))
+ time_re = _strptime.TimeRE(locale_time)
+ self.failUnless(time_re.compile("%Z").match("Tokyo (standard time)"),
+ "locale data that contains regex metacharacters is not"
+ " properly escaped")
+
class StrptimeTests(unittest.TestCase):
"""Tests for _strptime.strptime."""