Issue #23821: Fixed test_pdb failure under -O.

This commit is contained in:
Serhiy Storchaka 2015-04-01 16:58:19 +03:00
parent c512adc90d
commit a16de5dbf5
1 changed files with 15 additions and 11 deletions

View File

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