@@ -24,7 +24,7 @@ def test_split_when_all_exception_matched():
24
24
group = ExceptionGroup (
25
25
"Many Errors" ,
26
26
[RuntimeError ("Runtime Error1" ), RuntimeError ("Runtime Error2" )],
27
- ["Runtime Error1" , "Runtime Error2" ]
27
+ ["Runtime Error1" , "Runtime Error2" ],
28
28
)
29
29
matched , unmatched = split (RuntimeError , group )
30
30
assert matched is group
@@ -35,7 +35,7 @@ def test_split_when_all_exception_unmatched():
35
35
group = ExceptionGroup (
36
36
"Many Errors" ,
37
37
[RuntimeError ("Runtime Error1" ), RuntimeError ("Runtime Error2" )],
38
- ["Runtime Error1" , "Runtime Error2" ]
38
+ ["Runtime Error1" , "Runtime Error2" ],
39
39
)
40
40
matched , unmatched = split (ValueError , group )
41
41
assert matched is None
@@ -46,31 +46,27 @@ def test_split_when_contains_matched_and_unmatched():
46
46
error1 = RuntimeError ("Runtime Error1" )
47
47
error2 = ValueError ("Value Error2" )
48
48
group = ExceptionGroup (
49
- "Many Errors" ,
50
- [error1 , error2 ],
51
- ['Runtime Error1' , 'Value Error2' ]
49
+ "Many Errors" , [error1 , error2 ], ["Runtime Error1" , "Value Error2" ]
52
50
)
53
51
matched , unmatched = split (RuntimeError , group )
54
52
assert isinstance (matched , ExceptionGroup )
55
53
assert isinstance (unmatched , ExceptionGroup )
56
54
assert matched .exceptions == [error1 ]
57
55
assert matched .message == "Many Errors"
58
- assert matched .sources == [' Runtime Error1' ]
56
+ assert matched .sources == [" Runtime Error1" ]
59
57
assert unmatched .exceptions == [error2 ]
60
58
assert unmatched .message == "Many Errors"
61
- assert unmatched .sources == [' Value Error2' ]
59
+ assert unmatched .sources == [" Value Error2" ]
62
60
63
61
64
62
def test_split_with_predicate ():
65
63
def _match (err ):
66
- return str (err ) != ' skip'
64
+ return str (err ) != " skip"
67
65
68
66
error1 = RuntimeError ("skip" )
69
67
error2 = RuntimeError ("Runtime Error" )
70
68
group = ExceptionGroup (
71
- "Many Errors" ,
72
- [error1 , error2 ],
73
- ['skip' , 'Runtime Error' ]
69
+ "Many Errors" , [error1 , error2 ], ["skip" , "Runtime Error" ]
74
70
)
75
71
matched , unmatched = split (RuntimeError , group , match = _match )
76
72
assert matched .exceptions == [error2 ]
0 commit comments