File tree 1 file changed +6
-11
lines changed 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -107,15 +107,11 @@ class for all warnings. To raise multiple types of exceptions,
107
107
yield w
108
108
finally :
109
109
if expected_warning :
110
- if type (expected_warning ) == tuple and must_find_all_warnings :
111
- expected_warning = cast (tuple [type [Warning ]], expected_warning )
110
+ if isinstance (expected_warning , tuple ) and must_find_all_warnings :
112
111
match = (
113
112
match
114
- if type (match ) == tuple
115
- else tuple (
116
- cast (str | None , match )
117
- for i in range (len (expected_warning ))
118
- )
113
+ if isinstance (match , tuple )
114
+ else tuple (match for i in range (len (expected_warning )))
119
115
)
120
116
for warning_type , warning_match in zip (expected_warning , match ):
121
117
_assert_caught_expected_warning (
@@ -126,11 +122,10 @@ class for all warnings. To raise multiple types of exceptions,
126
122
)
127
123
else :
128
124
expected_warning = cast (type [Warning ], expected_warning )
129
- match = cast (
130
- str ,
125
+ match = (
131
126
"|" .join (m for m in match if m )
132
- if type (match ) == tuple
133
- else match ,
127
+ if isinstance (match , tuple )
128
+ else match
134
129
)
135
130
_assert_caught_expected_warning (
136
131
caught_warnings = w ,
You can’t perform that action at this time.
0 commit comments