bpo-45489: Update ForwardRef to support | operator. (GH-28991)

This commit is contained in:
Dong-hee Na 2021-10-17 00:12:58 +09:00 committed by GitHub
parent 4ecd119b00
commit 15ad52fbf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -2903,6 +2903,12 @@ class ForwardRefTests(BaseTestCase):
self.assertNotEqual(gth(Loop, globals())['attr'], Final[int])
self.assertNotEqual(gth(Loop, globals())['attr'], Final)
def test_or(self):
X = ForwardRef('X')
# __or__/__ror__ itself
self.assertEqual(X | "x", Union[X, "x"])
self.assertEqual("x" | X, Union["x", X])
class OverloadTests(BaseTestCase):