From 73482936a4eabeb3e51425f3b5c56d1d9e0a9bb9 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 24 Apr 2023 07:23:59 +0200 Subject: Various TryStar fixes (#2142) --- tests/test_group_exceptions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_group_exceptions.py b/tests/test_group_exceptions.py index 173c25ed..11065aa4 100644 --- a/tests/test_group_exceptions.py +++ b/tests/test_group_exceptions.py @@ -54,9 +54,8 @@ def test_group_exceptions() -> None: @pytest.mark.skipif(not PY311_PLUS, reason="Requires Python 3.11 or higher") def test_star_exceptions() -> None: - node = extract_node( - textwrap.dedent( - """ + code = textwrap.dedent( + """ try: raise ExceptionGroup("group", [ValueError(654)]) except* ValueError: @@ -67,9 +66,10 @@ def test_star_exceptions() -> None: sys.exit(127) finally: sys.exit(0)""" - ) ) + node = extract_node(code) assert isinstance(node, TryStar) + assert node.as_string() == code.replace('"', "'").strip() assert isinstance(node.body[0], Raise) assert node.block_range(1) == (1, 11) assert node.block_range(2) == (2, 2) -- cgit v1.2.1