@@ -43,6 +43,52 @@ def test_exception_group_init_when_exceptions_messages_not_equal():
43
43
)
44
44
45
45
46
+ def test_exception_group_bool ():
47
+ assert not ExceptionGroup ("E" , [], [])
48
+ assert ExceptionGroup ("E" , [ValueError ()], ["" ])
49
+
50
+
51
+ def test_exception_group_contains ():
52
+ err = ValueError ()
53
+ group = ExceptionGroup ("E" , [err ], ["" ])
54
+ assert err in group
55
+ assert ValueError () not in group
56
+
57
+
58
+ def test_exception_group_find ():
59
+ err = ValueError ()
60
+ group = ExceptionGroup ("E" , [err ], ["" ])
61
+ assert group .find (ValueError ) is err
62
+ assert group .find (TypeError ) is None
63
+
64
+
65
+ def test_exception_group_find_with_source ():
66
+ err = ValueError ()
67
+ group = ExceptionGroup ("E" , [err ], ["x" ])
68
+ assert group .find (ValueError , with_source = True ) == (err , "x" )
69
+ assert group .find (TypeError , with_source = True ) is None
70
+
71
+
72
+ def test_exception_group_findall ():
73
+ err1 = ValueError ()
74
+ err2 = TypeError ()
75
+ group = ExceptionGroup ("E" , [err1 , err2 ], ["" , "" ])
76
+ assert tuple (group .findall (ValueError )) == (err1 ,)
77
+ assert tuple (group .findall ((ValueError , TypeError ))) == (err1 , err2 )
78
+
79
+
80
+ def test_exception_group_iter ():
81
+ err1 = ValueError ()
82
+ err2 = ValueError ()
83
+ group = ExceptionGroup ("E" , [err1 , err2 ], ["" , "" ])
84
+ assert tuple (group ) == ((err1 , "" ), (err2 , "" ))
85
+
86
+
87
+ def test_exception_group_len ():
88
+ assert len (ExceptionGroup ("E" , [], [])) == 0
89
+ assert len (ExceptionGroup ("E" , [ValueError ()], ["" ])) == 1
90
+
91
+
46
92
def test_exception_group_str ():
47
93
memberA = ValueError ("memberA" )
48
94
memberB = ValueError ("memberB" )
0 commit comments