summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/doctest.py
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 435e13b..d120a01 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1604,8 +1604,8 @@ class DebugRunner(DocTestRunner):
... {}, 'foo', 'foo.py', 0)
>>> try:
... runner.run(test)
- ... except UnexpectedException, failure:
- ... pass
+ ... except UnexpectedException as f:
+ ... failure = f
>>> failure.test is test
True
@@ -1632,8 +1632,8 @@ class DebugRunner(DocTestRunner):
>>> try:
... runner.run(test)
- ... except DocTestFailure, failure:
- ... pass
+ ... except DocTestFailure as f:
+ ... failure = f
DocTestFailure objects provide access to the test:
@@ -2141,8 +2141,8 @@ class DocTestCase(unittest.TestCase):
>>> case = DocTestCase(test)
>>> try:
... case.debug()
- ... except UnexpectedException, failure:
- ... pass
+ ... except UnexpectedException as f:
+ ... failure = f
The UnexpectedException contains the test, the example, and
the original exception:
@@ -2170,8 +2170,8 @@ class DocTestCase(unittest.TestCase):
>>> try:
... case.debug()
- ... except DocTestFailure, failure:
- ... pass
+ ... except DocTestFailure as f:
+ ... failure = f
DocTestFailure objects provide access to the test: