Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a783b3

Browse files
Update Lib/test/support/__init__.py
Co-authored-by: Alex Waygood <[email protected]>
1 parent a64922f commit 8a783b3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/test/support/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,14 @@ def sortdict(dict):
620620
withcommas = ", ".join(reprpairs)
621621
return "{%s}" % withcommas
622622

623+
623624
def run_code(code: str) -> dict[str, object]:
624625
"""Run a piece of code after dedenting it, and return its global namespace."""
625626
ns = {}
626627
exec(textwrap.dedent(code), ns)
627628
return ns
628629

630+
629631
def check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None):
630632
with testcase.assertRaisesRegex(SyntaxError, errtext) as cm:
631633
compile(statement, '<test string>', 'exec')

0 commit comments

Comments
 (0)