File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 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,
107107 yield w
108108 finally :
109109 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 :
112111 match = (
113112 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 )))
119115 )
120116 for warning_type , warning_match in zip (expected_warning , match ):
121117 _assert_caught_expected_warning (
@@ -126,11 +122,10 @@ class for all warnings. To raise multiple types of exceptions,
126122 )
127123 else :
128124 expected_warning = cast (type [Warning ], expected_warning )
129- match = cast (
130- str ,
125+ match = (
131126 "|" .join (m for m in match if m )
132- if type (match ) == tuple
133- else match ,
127+ if isinstance (match , tuple )
128+ else match
134129 )
135130 _assert_caught_expected_warning (
136131 caught_warnings = w ,
You can’t perform that action at this time.
0 commit comments