Skip to content

Commit 38d54d4

Browse files
committed
Move code to have smaller diff
1 parent 8913133 commit 38d54d4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Lib/test/test_pyexpat.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,21 @@ def check_traceback_entry(self, entry, filename, funcname):
448448
self.assertEqual(os.path.basename(entry.filename), filename)
449449
self.assertEqual(entry.name, funcname)
450450

451+
@support.cpython_only
452+
def test_exception(self):
453+
# gh-66652: test _PyTraceback_Add() used by pyexpat.c to inject frames
454+
455+
# Change the current directory to the Python source code directory
456+
# if it is available.
457+
src_dir = sysconfig.get_config_var('abs_builddir')
458+
have_source = os.path.isdir(src_dir)
459+
if have_source:
460+
cm = os_helper.change_cwd(src_dir)
461+
else:
462+
cm = contextlib.nullcontext()
463+
with cm:
464+
self._test_exception(have_source)
465+
451466
def _test_exception(self, have_source):
452467
# Use path relative to the current directory which should be the Python
453468
# source code directory (if it is available).
@@ -479,21 +494,6 @@ def _test_exception(self, have_source):
479494
self.assertIn('call_with_frame("StartElement"',
480495
entries[1].line)
481496

482-
@support.cpython_only
483-
def test_exception(self):
484-
# gh-66652: test _PyTraceback_Add() used by pyexpat.c to inject frames
485-
486-
# Change the current directory to the Python source code directory
487-
# if it is available.
488-
src_dir = sysconfig.get_config_var('abs_builddir')
489-
have_source = os.path.isdir(src_dir)
490-
if have_source:
491-
cm = os_helper.change_cwd(src_dir)
492-
else:
493-
cm = contextlib.nullcontext()
494-
with cm:
495-
self._test_exception(have_source)
496-
497497

498498
# Test Current* members:
499499
class PositionTest(unittest.TestCase):

0 commit comments

Comments
 (0)