summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-04-04 02:16:27 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2013-04-04 02:16:27 +0300
commitd57f0476659151ba866c42ac6bb5b006c2e1bb55 (patch)
tree9997a8890094beacd24f952ac5c9d1ed8da5afd3 /Lib/test
parent8fc16b37ea229ff7090fa6fb23c403e91a0b25a5 (diff)
parent0f38908684505905fd0890f4effbe6f683b39954 (diff)
downloadcpython-git-d57f0476659151ba866c42ac6bb5b006c2e1bb55.tar.gz
#17572: merge with 3.3.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_strptime.py6
-rw-r--r--Lib/test/test_time.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 90aac5b3f6..68e6a67636 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -218,6 +218,12 @@ class StrptimeTests(unittest.TestCase):
else:
self.fail("'%s' did not raise ValueError" % bad_format)
+ def test_strptime_exception_context(self):
+ # check that this doesn't chain exceptions needlessly (see #17572)
+ with self.assertRaises(ValueError) as e:
+ _strptime._strptime_time('', '%D')
+ self.assertIs(e.exception.__suppress_context__, True)
+
def test_unconverteddata(self):
# Check ValueError is raised when there is unconverted data
self.assertRaises(ValueError, _strptime._strptime_time, "10 12", "%m")
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index da0f555d91..0e4d70284b 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -193,6 +193,12 @@ class TimeTestCase(unittest.TestCase):
self.assertRaises(TypeError, time.strptime, b'2009', "%Y")
self.assertRaises(TypeError, time.strptime, '2009', b'%Y')
+ def test_strptime_exception_context(self):
+ # check that this doesn't chain exceptions needlessly (see #17572)
+ with self.assertRaises(ValueError) as e:
+ time.strptime('', '%D')
+ self.assertIs(e.exception.__suppress_context__, True)
+
def test_asctime(self):
time.asctime(time.gmtime(self.t))