示例工程 09-exceptions-context-managers

09-exceptions-context-managers/05-exception-group/test_exception_group.py

python · 0.3 KB

"""test_exception_group.py"""
 
from __future__ import annotations
 
from exception_group import handle_group, unhandled_group
 
 
def test_except_star_handles_each_type() -> None:
    assert handle_group() == ["value:bad value", "type:bad type"]
 
 
def test_partial_handling_keeps_remaining_group() -> None:
    assert unhandled_group() == "KeyError"