summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2023-04-24 07:23:59 +0200
committerGitHub <noreply@github.com>2023-04-24 07:23:59 +0200
commit73482936a4eabeb3e51425f3b5c56d1d9e0a9bb9 (patch)
tree07da31ecf50ffbeb08c11e1968f06c91265fa53d /tests
parentc312218289798207813971af540fbed43c6963b5 (diff)
downloadastroid-git-73482936a4eabeb3e51425f3b5c56d1d9e0a9bb9.tar.gz
Various TryStar fixes (#2142)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_group_exceptions.py8
1 files changed, 4 insertions, 4 deletions
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)