Skip to content

Commit 7b8fe20

Browse files
committed
fix test
1 parent 701050f commit 7b8fe20

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

Lib/test/test_pdb.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4590,27 +4590,32 @@ def bar():
45904590
def test_issue_59000(self):
45914591
script = """
45924592
def foo():
4593-
pass
4593+
test_str = "break foo"
45944594
45954595
class C:
4596-
def c_foo(self):
4597-
pass
45984596
def foo(self):
4599-
pass
4597+
test_str = "break C.foo"
46004598
46014599
foo()
4600+
C().foo()
46024601
"""
46034602
commands = """
46044603
break foo
46054604
break C.foo
4606-
break C.c_foo
4607-
break 10
46084605
continue
46094606
break C.foo
4607+
continue
46104608
quit
46114609
"""
46124610
stdout, stderr = self.run_pdb_script(script, commands)
4613-
self.assertIn("The specified object 'C.c_foo' is not a function", stdout)
4611+
res_lines = [x.strip() for x in stdout.splitlines()]
4612+
print(res_lines)
4613+
# can't set breakpoint before class C is defined, and gives an error
4614+
self.assertIn("The specified object 'C.foo' is not a function", res_lines[3])
4615+
# can set correctly after the class C is defined
4616+
self.assertRegex(res_lines[6], r"Breakpoint 2 at .*main\.py:7")
4617+
self.assertIn('test_str = "break C.foo"', res_lines[8])
4618+
46144619

46154620

46164621
class ChecklineTests(unittest.TestCase):

0 commit comments

Comments
 (0)