From: Marc-André Lemburg Date: Wed, 5 Jul 2000 09:46:40 +0000 (+0000) Subject: Added tests for the new .isalpha() and .isalnum() methods. X-Git-Tag: v2.0b1~1078 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d4674168fa41b9b9e1968b69f42681ce61ca610;p=python Added tests for the new .isalpha() and .isalnum() methods. --- diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index ec57c2684d..c7c3e72bb8 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -84,6 +84,21 @@ test('istitle', 'Not a capitalized String', 0) test('istitle', 'Not\ta Titlecase String', 0) test('istitle', 'Not--a Titlecase String', 0) +test('isalpha', 'a', 1) +test('isalpha', 'A', 1) +test('isalpha', '\n', 0) +test('isalpha', 'abc', 1) +test('isalpha', 'aBc123', 0) +test('isalpha', 'abc\n', 0) + +test('isalnum', 'a', 1) +test('isalnum', 'A', 1) +test('isalnum', '\n', 0) +test('isalnum', '123abc456', 1) +test('isalnum', 'a1b3c', 1) +test('isalnum', 'aBc000 ', 0) +test('isalnum', 'abc\n', 0) + test('splitlines', "abc\ndef\n\rghi", ['abc', 'def', '', 'ghi']) test('splitlines', "abc\ndef\n\r\nghi", ['abc', 'def', '', 'ghi']) test('splitlines', "abc\ndef\r\nghi", ['abc', 'def', 'ghi']) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 85d0bca8ef..ec894ed418 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -206,6 +206,22 @@ test('istitle', u'Not a capitalized String', 0) test('istitle', u'Not\ta Titlecase String', 0) test('istitle', u'Not--a Titlecase String', 0) +test('isalpha', u'a', 1) +test('isalpha', u'A', 1) +test('isalpha', u'\n', 0) +test('isalpha', u'\u1FFc', 1) +test('isalpha', u'abc', 1) +test('isalpha', u'aBc123', 0) +test('isalpha', u'abc\n', 0) + +test('isalnum', u'a', 1) +test('isalnum', u'A', 1) +test('isalnum', u'\n', 0) +test('isalnum', u'123abc456', 1) +test('isalnum', u'a1b3c', 1) +test('isalnum', u'aBc000 ', 0) +test('isalnum', u'abc\n', 0) + test('splitlines', u"abc\ndef\n\rghi", [u'abc', u'def', u'', u'ghi']) test('splitlines', u"abc\ndef\n\r\nghi", [u'abc', u'def', u'', u'ghi']) test('splitlines', u"abc\ndef\r\nghi", [u'abc', u'def', u'ghi'])