mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-24234: Implement bytes.__bytes__ (GH-27901)
This commit is contained in:
parent
6082bb5add
commit
24b63c695a
7 changed files with 63 additions and 3 deletions
|
@ -1543,11 +1543,11 @@ class ProtocolTests(BaseTestCase):
|
|||
|
||||
def test_supports_bytes(self):
|
||||
|
||||
# Note: bytes itself doesn't have __bytes__.
|
||||
class B:
|
||||
def __bytes__(self):
|
||||
return b''
|
||||
|
||||
self.assertIsSubclass(bytes, typing.SupportsBytes)
|
||||
self.assertIsSubclass(B, typing.SupportsBytes)
|
||||
self.assertNotIsSubclass(str, typing.SupportsBytes)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue