File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -284,10 +284,12 @@ def __hash__(self):
284284 ))
285285
286286 def __or__ (self , other ):
287- return types .UnionType [self , other ]
287+ import typing
288+ return typing .Union [self , other ]
288289
289290 def __ror__ (self , other ):
290- return types .UnionType [other , self ]
291+ import typing
292+ return typing .Union [other , self ]
291293
292294 def __repr__ (self ):
293295 extra = []
Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ class UnionForwardrefs:
137137 str | int ,
138138 )
139139 union = annos ["union" ]
140- self .assertIsInstance (union , Union )
140+ self .assertIs (typing .get_origin (union ), Union )
141+ # self.assertIsInstance(union, Union)
141142 arg1 , arg2 = typing .get_args (union )
142143 self .assertIs (arg1 , str )
143144 self .assertEqual (
You can’t perform that action at this time.
0 commit comments