Skip to content

Commit eeef8cd

Browse files
changed test_legacy_union to test_typing_union. Changed behavior due to gh-105499
1 parent 2f9aa38 commit eeef8cd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/test/test_patma.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,16 +3457,15 @@ def test_class_or_union_not_specialform(self):
34573457
w = 0
34583458
self.assertIsNone(w)
34593459

3460-
def test_legacy_union_type(self):
3460+
def test_typing_union(self):
34613461
from typing import Union
34623462
IntOrStr = Union[int, str]
34633463
name = type(IntOrStr).__name__
34643464
msg = rf"called match pattern must be a class or typing.Union of classes \(got {name}\)"
34653465
w = None
3466-
with self.assertRaisesRegex(TypeError, msg):
3467-
match 1:
3468-
case IntOrStr():
3469-
w = 0
3466+
match 1:
3467+
case IntOrStr():
3468+
w = 0
34703469
self.assertIsNone(w)
34713470

34723471
def test_expanded_union_mirrors_isinstance_success(self):

0 commit comments

Comments
 (0)