[Python-checkins] cpython (3.4): Issue #23821: Fixed test_pdb failure under -O.

serhiy.storchaka python-checkins at python.org
Wed Apr 1 15:59:07 CEST 2015


https://hg.python.org/cpython/rev/26778732099d
changeset:   95347:26778732099d
branch:      3.4
parent:      95345:88a0e6cd93c3
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Apr 01 16:58:19 2015 +0300
summary:
  Issue #23821: Fixed test_pdb failure under -O.

files:
  Lib/test/test_pdb.py |  26 +++++++++++++++-----------
  1 files changed, 15 insertions(+), 11 deletions(-)


diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -677,10 +677,12 @@
     ...     import pdb; pdb.Pdb(nosigint=True).set_trace()
     ...     it = test_gen()
     ...     try:
-    ...         assert next(it) == 0
+    ...         if next(it) != 0:
+    ...             raise AssertionError
     ...         next(it)
     ...     except StopIteration as ex:
-    ...         assert ex.value == 1
+    ...         if ex.value != 1:
+    ...             raise AssertionError
     ...     print("finished")
 
     >>> with PdbTestInput(['step',
@@ -699,7 +701,7 @@
     -> try:
     (Pdb) step
     > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(5)test_function()
-    -> assert next(it) == 0
+    -> if next(it) != 0:
     (Pdb) step
     --Call--
     > <doctest test.test_pdb.test_pdb_next_command_for_generator[0]>(1)test_gen()
@@ -716,7 +718,7 @@
     -> return 1
     (Pdb) step
     StopIteration: 1
-    > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(6)test_function()
+    > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(7)test_function()
     -> next(it)
     (Pdb) continue
     finished
@@ -735,10 +737,12 @@
     ...     import pdb; pdb.Pdb(nosigint=True).set_trace()
     ...     it = test_gen()
     ...     try:
-    ...         assert next(it) == 0
+    ...         if next(it) != 0:
+    ...             raise AssertionError
     ...         next(it)
     ...     except StopIteration as ex:
-    ...         assert ex.value == 1
+    ...         if ex.value != 1:
+    ...             raise AssertionError
     ...     print("finished")
 
     >>> with PdbTestInput(['step',
@@ -756,21 +760,21 @@
     -> try:
     (Pdb) step
     > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(5)test_function()
-    -> assert next(it) == 0
+    -> if next(it) != 0:
     (Pdb) step
     --Call--
     > <doctest test.test_pdb.test_pdb_return_command_for_generator[0]>(1)test_gen()
     -> def test_gen():
     (Pdb) return
     StopIteration: 1
-    > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(6)test_function()
+    > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(7)test_function()
     -> next(it)
     (Pdb) step
-    > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(7)test_function()
+    > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(8)test_function()
     -> except StopIteration as ex:
     (Pdb) step
-    > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(8)test_function()
-    -> assert ex.value == 1
+    > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(9)test_function()
+    -> if ex.value != 1:
     (Pdb) continue
     finished
     """

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list