mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)
This commit is contained in:
parent
85527cf50a
commit
a49ac99029
13 changed files with 110 additions and 2 deletions
|
|
@ -909,6 +909,14 @@ class BaseTest:
|
|||
self.checkequal(False, 'abc\n', 'isalnum')
|
||||
self.checkraises(TypeError, 'abc', 'isalnum', 42)
|
||||
|
||||
def test_isascii(self):
|
||||
self.checkequal(True, '', 'isascii')
|
||||
self.checkequal(True, '\x00', 'isascii')
|
||||
self.checkequal(True, '\x7f', 'isascii')
|
||||
self.checkequal(True, '\x00\x7f', 'isascii')
|
||||
self.checkequal(False, '\x80', 'isascii')
|
||||
self.checkequal(False, '\xe9', 'isascii')
|
||||
|
||||
def test_isdigit(self):
|
||||
self.checkequal(False, '', 'isdigit')
|
||||
self.checkequal(False, 'a', 'isdigit')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue