summaryrefslogtreecommitdiffstats
path: root/Lib/test/string_tests.py
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2018-01-27 05:06:21 (GMT)
committerGitHub <noreply@github.com>2018-01-27 05:06:21 (GMT)
commita49ac9902903a798fab4970ccf563c531199c3f8 (patch)
tree56390f8d6849446b23d3d2a152c6197fc724ae70 /Lib/test/string_tests.py
parent85527cf50a9a4eecaca4022f7c6cb9e0bae1fa5f (diff)
downloadcpython-a49ac9902903a798fab4970ccf563c531199c3f8.zip
cpython-a49ac9902903a798fab4970ccf563c531199c3f8.tar.gz
cpython-a49ac9902903a798fab4970ccf563c531199c3f8.tar.bz2
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r--Lib/test/string_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index cd3ee48..4be1d21 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -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')