[3.11] gh-115570: Fix DeprecationWarnings in test_typing (#115571)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Jelle Zijlstra 2024-02-16 11:37:42 -08:00 committed by GitHub
parent 963315cbd9
commit c01a4808d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

@ -7319,6 +7319,17 @@ class RETests(BaseTestCase):
self.assertEqual(__name__, 'typing.re')
self.assertEqual(len(w), 1)
def test_re_submodule_access_basics(self):
with warnings.catch_warnings():
warnings.filterwarnings("error", category=DeprecationWarning)
from typing import re
self.assertIsInstance(re.__doc__, str)
self.assertEqual(re.__name__, "typing.re")
self.assertIsInstance(re.__dict__, types.MappingProxyType)
with self.assertWarns(DeprecationWarning):
re.Match
def test_cannot_subclass(self):
with self.assertRaises(TypeError) as ex: