summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-01 13:58:39 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-01 13:58:39 (GMT)
commitc19c3960bb866f665111e5b56cf7d12ae2c90f32 (patch)
treec7253d9f0dd31c3aba1eab9b76211927b7fa4d2d /Lib
parent05ddbf0875b449f69616c31fbbe49dd5f3d5e329 (diff)
parenta16de5dbf54ea9fbad33982482122f6abdd19425 (diff)
downloadcpython-c19c3960bb866f665111e5b56cf7d12ae2c90f32.zip
cpython-c19c3960bb866f665111e5b56cf7d12ae2c90f32.tar.gz
cpython-c19c3960bb866f665111e5b56cf7d12ae2c90f32.tar.bz2
Issue #23821: Fixed test_pdb failure under -O.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_pdb.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index edc9e75..ec8346c 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -677,10 +677,12 @@ def test_pdb_next_command_for_generator():
... 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 @@ def test_pdb_next_command_for_generator():
-> 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 @@ def test_pdb_next_command_for_generator():
-> 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 @@ def test_pdb_return_command_for_generator():
... 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 @@ def test_pdb_return_command_for_generator():
-> 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
"""