diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 3422dc1ed3f5f8..c9bfd2b012dc00 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -6004,8 +6004,9 @@ def test_mutablesequence(self): self.assertNotIsInstance((), typing.MutableSequence) def test_bytestring(self): + _typing = import_fresh_module('typing') with self.assertWarns(DeprecationWarning): - from typing import ByteString + ByteString = _typing.ByteString with self.assertWarns(DeprecationWarning): self.assertIsInstance(b'', ByteString) with self.assertWarns(DeprecationWarning): @@ -6013,7 +6014,7 @@ def test_bytestring(self): with self.assertWarns(DeprecationWarning): class Foo(ByteString): ... with self.assertWarns(DeprecationWarning): - class Bar(ByteString, typing.Awaitable): ... + class Bar(ByteString, _typing.Awaitable): ... def test_list(self): self.assertIsSubclass(list, typing.List)