|
3 | 3 | import pickle |
4 | 4 | import re |
5 | 5 | import sys |
| 6 | +import warnings |
6 | 7 | from unittest import TestCase, main, skipUnless, skip |
7 | 8 | from copy import copy, deepcopy |
8 | 9 |
|
@@ -1976,7 +1977,7 @@ def test_weakref_all(self): |
1976 | 1977 | T = TypeVar('T') |
1977 | 1978 | things = [Any, Union[T, int], Callable[..., T], Tuple[Any, Any], |
1978 | 1979 | Optional[List[int]], typing.Mapping[int, str], |
1979 | | - typing.re.Match[bytes], typing.Iterable['whatever']] |
| 1980 | + typing.Match[bytes], typing.Iterable['whatever']] |
1980 | 1981 | for t in things: |
1981 | 1982 | self.assertEqual(weakref.ref(t)(), t) |
1982 | 1983 |
|
@@ -3996,12 +3997,14 @@ def stuff(a: BinaryIO) -> bytes: |
3996 | 3997 | self.assertEqual(a.__parameters__, ()) |
3997 | 3998 |
|
3998 | 3999 | def test_io_submodule(self): |
3999 | | - from typing.io import IO, TextIO, BinaryIO, __all__, __name__ |
4000 | | - self.assertIs(IO, typing.IO) |
4001 | | - self.assertIs(TextIO, typing.TextIO) |
4002 | | - self.assertIs(BinaryIO, typing.BinaryIO) |
4003 | | - self.assertEqual(set(__all__), set(['IO', 'TextIO', 'BinaryIO'])) |
4004 | | - self.assertEqual(__name__, 'typing.io') |
| 4000 | + with warnings.catch_warnings(record=True) as w: |
| 4001 | + from typing.io import IO, TextIO, BinaryIO, __all__, __name__ |
| 4002 | + self.assertIs(IO, typing.IO) |
| 4003 | + self.assertIs(TextIO, typing.TextIO) |
| 4004 | + self.assertIs(BinaryIO, typing.BinaryIO) |
| 4005 | + self.assertEqual(set(__all__), set(['IO', 'TextIO', 'BinaryIO'])) |
| 4006 | + self.assertEqual(__name__, 'typing.io') |
| 4007 | + self.assertEqual(len(w), 1) |
4005 | 4008 |
|
4006 | 4009 |
|
4007 | 4010 | class RETests(BaseTestCase): |
@@ -4048,11 +4051,13 @@ def test_repr(self): |
4048 | 4051 | self.assertEqual(repr(Match[bytes]), 'typing.Match[bytes]') |
4049 | 4052 |
|
4050 | 4053 | def test_re_submodule(self): |
4051 | | - from typing.re import Match, Pattern, __all__, __name__ |
4052 | | - self.assertIs(Match, typing.Match) |
4053 | | - self.assertIs(Pattern, typing.Pattern) |
4054 | | - self.assertEqual(set(__all__), set(['Match', 'Pattern'])) |
4055 | | - self.assertEqual(__name__, 'typing.re') |
| 4054 | + with warnings.catch_warnings(record=True) as w: |
| 4055 | + from typing.re import Match, Pattern, __all__, __name__ |
| 4056 | + self.assertIs(Match, typing.Match) |
| 4057 | + self.assertIs(Pattern, typing.Pattern) |
| 4058 | + self.assertEqual(set(__all__), set(['Match', 'Pattern'])) |
| 4059 | + self.assertEqual(__name__, 'typing.re') |
| 4060 | + self.assertEqual(len(w), 1) |
4056 | 4061 |
|
4057 | 4062 | def test_cannot_subclass(self): |
4058 | 4063 | with self.assertRaises(TypeError) as ex: |
|
0 commit comments