Skip to content

Commit 62bb015

Browse files
Copilotyouknowone
andcommitted
Move except* and starred subscript tests into builtin_exceptions
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
1 parent c37fc4f commit 62bb015

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

extra_tests/snippets/builtin_exceptions.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,18 @@ class SubError(MyError):
366366
vars(builtins).values(),
367367
):
368368
assert isinstance(exc.__doc__, str)
369+
370+
371+
# except* handling should normalize non-group exceptions
372+
try:
373+
raise ValueError("x")
374+
except* ValueError as err:
375+
assert isinstance(err, ExceptionGroup)
376+
assert err.exceptions == (ValueError("x"),)
377+
else:
378+
assert False, "except* handler did not run"
379+
380+
# Starred expressions in subscripts build tuple keys
381+
mapping = {}
382+
mapping[*"ab"] = 1
383+
assert list(mapping.items()) == [(("a", "b"), 1)]

extra_tests/snippets/except_star_and_starred_index.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)