Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-104415: Fix refleak tests for typing.ByteString deprecation
  • Loading branch information
sobolevn committed May 12, 2023
commit e8f6c3d5d484ed02905c09c647dcae34c0f3c835
5 changes: 3 additions & 2 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6004,16 +6004,17 @@ 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):
self.assertIsInstance(bytearray(b''), ByteString)
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)
Expand Down