Skip to content

Commit

Permalink
Merge 1923fa0 into 3fb346b
Browse files Browse the repository at this point in the history
  • Loading branch information
gagath committed Dec 4, 2022
2 parents 3fb346b + 1923fa0 commit d366e64
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_catch_py311.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import sys

import pytest

from exceptiongroup import ExceptionGroup


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_ungrouped():
value_type_errors = []
zero_division_errors = []
Expand Down Expand Up @@ -30,6 +34,8 @@ def test_catch_ungrouped():
assert len(zero_division_errors[0].exceptions) == 1


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_group():
value_runtime_errors = []
zero_division_errors = []
Expand Down Expand Up @@ -61,6 +67,8 @@ def test_catch_group():
assert isinstance(exceptions[0], ZeroDivisionError)


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_nested_group():
value_runtime_errors = []
zero_division_errors = []
Expand Down Expand Up @@ -88,6 +96,8 @@ def test_catch_nested_group():
)


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_no_match():
try:
try:
Expand All @@ -102,6 +112,8 @@ def test_catch_no_match():
pytest.fail("Did not raise an ExceptionGroup")


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_single_no_match():
try:
try:
Expand All @@ -114,13 +126,17 @@ def test_catch_single_no_match():
pytest.fail("Did not raise an ZeroDivisionError")


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_full_match():
try:
raise ExceptionGroup("booboo", [ValueError()])
except* (ValueError, RuntimeError):
pass


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_handler_raises():
try:
try:
Expand All @@ -135,6 +151,8 @@ def test_catch_handler_raises():
pytest.fail("Did not raise an ExceptionGroup")


@pytest.mark.skipif(sys.version_info < (3,11),
reason="requires python3.11")
def test_catch_subclass():
lookup_errors = []
try:
Expand Down

0 comments on commit d366e64

Please sign in to comment.