Update test_bdb.py from CPython v3.12.0

This commit is contained in:
NakanoMiku committed 2023-12-24 04:03:20 +08:00
1 parent a00a387735
commit dd0c393b45
1 file changed
+18 -1
+18 -1
View File
@@ -59,6 +59,7 @@ from contextlib import contextmanager
from itertools import islice, repeat
from test.support import import_helper
from test.support import os_helper
from test.support import patch_list
class BdbException(Exception): pass
@@ -432,8 +433,9 @@ class TracerRun():
not_empty = ''
if self.tracer.set_list:
not_empty += 'All paired tuples have not been processed, '
not_empty += ('the last one was number %d' %
not_empty += ('the last one was number %d\n' %
self.tracer.expect_set_no)
not_empty += repr(self.tracer.set_list)
# Make a BdbNotExpectedError a unittest failure.
if type_ is not None and issubclass(BdbNotExpectedError, type_):
@@ -728,6 +730,14 @@ class StateTestCase(BaseTestCase):
def test_skip(self):
# Check that tracing is skipped over the import statement in
# 'tfunc_import()'.
# Remove all but the standard importers.
sys.meta_path[:] = (
item
for item in sys.meta_path
if item.__module__.startswith('_frozen_importlib')
)
code = """
def main():
lno = 3
@@ -1224,5 +1234,12 @@ class IssuesTestCase(BaseTestCase):
tracer.runcall(tfunc_import)
class TestRegressions(unittest.TestCase):
def test_format_stack_entry_no_lineno(self):
# See gh-101517
self.assertIn('Warning: lineno is None',
Bdb().format_stack_entry((sys._getframe(), None)))
if __name__ == "__main__":
unittest.main()