diff options
author | Guido van Rossum <guido@python.org> | 2002-04-03 22:41:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-04-03 22:41:51 (GMT) |
commit | 77f6a65eb00f005939c6c7c5d6ac0f037a0ce1bd (patch) | |
tree | e92163095e7ae548c36cea459dad87db74a413ef /Lib/test | |
parent | e9c0358bf45bd6e0fe0b17720b41d20d618e6d9d (diff) | |
download | cpython-77f6a65eb00f005939c6c7c5d6ac0f037a0ce1bd.zip cpython-77f6a65eb00f005939c6c7c5d6ac0f037a0ce1bd.tar.gz cpython-77f6a65eb00f005939c6c7c5d6ac0f037a0ce1bd.tar.bz2 |
Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285. Everything described in the PEP is here, and there is even
some documentation. I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison. I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.
Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/output/test_augassign | 12 | ||||
-rw-r--r-- | Lib/test/output/test_extcall | 2 | ||||
-rw-r--r-- | Lib/test/output/test_gettext | 2 | ||||
-rw-r--r-- | Lib/test/output/test_grammar | 2 | ||||
-rw-r--r-- | Lib/test/output/test_richcmp | 144 | ||||
-rw-r--r-- | Lib/test/test_descr.py | 2 | ||||
-rw-r--r-- | Lib/test/test_descrtut.py | 12 | ||||
-rw-r--r-- | Lib/test/test_generators.py | 24 | ||||
-rw-r--r-- | Lib/test/test_unicode.py | 144 |
9 files changed, 172 insertions, 172 deletions
diff --git a/Lib/test/output/test_augassign b/Lib/test/output/test_augassign index 2a461f6..af840f8 100644 --- a/Lib/test/output/test_augassign +++ b/Lib/test/output/test_augassign @@ -4,14 +4,14 @@ test_augassign 6 [1, 2, 3, 4, 1, 2, 3, 4] [1, 2, 1, 2, 3] -1 -1 -1 +True +True +True 11 -1 +True 12 -1 -1 +True +True 13 __add__ called __radd__ called diff --git a/Lib/test/output/test_extcall b/Lib/test/output/test_extcall index ddb2be5..15a5c65 100644 --- a/Lib/test/output/test_extcall +++ b/Lib/test/output/test_extcall @@ -31,7 +31,7 @@ h() argument after ** must be a dictionary dir() argument after ** must be a dictionary NoneType object argument after ** must be a dictionary dir() got multiple values for keyword argument 'b' -3 512 1 +3 512 True 3 3 za () {} -> za() takes exactly 1 argument (0 given) diff --git a/Lib/test/output/test_gettext b/Lib/test/output/test_gettext index 9073166..0ff8a3f 100644 --- a/Lib/test/output/test_gettext +++ b/Lib/test/output/test_gettext @@ -23,7 +23,7 @@ trggrkg zrffntr pngnybt yvoenel. wink wink bacon test api 2 -1 +True gettext albatross bacon diff --git a/Lib/test/output/test_grammar b/Lib/test/output/test_grammar index 5240bed..6cf5862 100644 --- a/Lib/test/output/test_grammar +++ b/Lib/test/output/test_grammar @@ -60,6 +60,6 @@ classdef [3, 4, 5] [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] -[0, 0, 0] +[False, False, False] [[1, 2], [3, 4], [5, 6]] [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] diff --git a/Lib/test/output/test_richcmp b/Lib/test/output/test_richcmp index 2a9c787..4488c35 100644 --- a/Lib/test/output/test_richcmp +++ b/Lib/test/output/test_richcmp @@ -4,54 +4,54 @@ operator: < | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- -Number(0) | 0 | 1 | 1 | -Number(1) | 0 | 0 | 1 | -Number(2) | 0 | 0 | 0 | +Number(0) | False | True | True | +Number(1) | False | False | True | +Number(2) | False | False | False | ----------+-----------+-----------+-----------+- operator: <= | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- -Number(0) | 1 | 1 | 1 | -Number(1) | 0 | 1 | 1 | -Number(2) | 0 | 0 | 1 | +Number(0) | True | True | True | +Number(1) | False | True | True | +Number(2) | False | False | True | ----------+-----------+-----------+-----------+- operator: == | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- -Number(0) | 1 | 0 | 0 | -Number(1) | 0 | 1 | 0 | -Number(2) | 0 | 0 | 1 | +Number(0) | True | False | False | +Number(1) | False | True | False | +Number(2) | False | False | True | ----------+-----------+-----------+-----------+- operator: != | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- -Number(0) | 0 | 1 | 1 | -Number(1) | 1 | 0 | 1 | -Number(2) | 1 | 1 | 0 | +Number(0) | False | True | True | +Number(1) | True | False | True | +Number(2) | True | True | False | ----------+-----------+-----------+-----------+- operator: > | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- -Number(0) | 0 | 0 | 0 | -Number(1) | 1 | 0 | 0 | -Number(2) | 1 | 1 | 0 | +Number(0) | False | False | False | +Number(1) | True | False | False | +Number(2) | True | True | False | ----------+-----------+-----------+-----------+- operator: >= | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- -Number(0) | 1 | 0 | 0 | -Number(1) | 1 | 1 | 0 | -Number(2) | 1 | 1 | 1 | +Number(0) | True | False | False | +Number(1) | True | True | False | +Number(2) | True | True | True | ----------+-----------+-----------+-----------+- ************************************************** @@ -60,54 +60,54 @@ operator: < | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- - 0 | 0 | 1 | 1 | - 1 | 0 | 0 | 1 | - 2 | 0 | 0 | 0 | + 0 | False | True | True | + 1 | False | False | True | + 2 | False | False | False | ----------+-----------+-----------+-----------+- operator: <= | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- - 0 | 1 | 1 | 1 | - 1 | 0 | 1 | 1 | - 2 | 0 | 0 | 1 | + 0 | True | True | True | + 1 | False | True | True | + 2 | False | False | True | ----------+-----------+-----------+-----------+- operator: == | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- - 0 | 1 | 0 | 0 | - 1 | 0 | 1 | 0 | - 2 | 0 | 0 | 1 | + 0 | True | False | False | + 1 | False | True | False | + 2 | False | False | True | ----------+-----------+-----------+-----------+- operator: != | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- - 0 | 0 | 1 | 1 | - 1 | 1 | 0 | 1 | - 2 | 1 | 1 | 0 | + 0 | False | True | True | + 1 | True | False | True | + 2 | True | True | False | ----------+-----------+-----------+-----------+- operator: > | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- - 0 | 0 | 0 | 0 | - 1 | 1 | 0 | 0 | - 2 | 1 | 1 | 0 | + 0 | False | False | False | + 1 | True | False | False | + 2 | True | True | False | ----------+-----------+-----------+-----------+- operator: >= | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- - 0 | 1 | 0 | 0 | - 1 | 1 | 1 | 0 | - 2 | 1 | 1 | 1 | + 0 | True | False | False | + 1 | True | True | False | + 2 | True | True | True | ----------+-----------+-----------+-----------+- ************************************************** @@ -116,72 +116,72 @@ operator: < | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- -Number(0) | 0 | 1 | 1 | -Number(1) | 0 | 0 | 1 | -Number(2) | 0 | 0 | 0 | +Number(0) | False | True | True | +Number(1) | False | False | True | +Number(2) | False | False | False | ----------+-----------+-----------+-----------+- operator: <= | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- -Number(0) | 1 | 1 | 1 | -Number(1) | 0 | 1 | 1 | -Number(2) | 0 | 0 | 1 | +Number(0) | True | True | True | +Number(1) | False | True | True | +Number(2) | False | False | True | ----------+-----------+-----------+-----------+- operator: == | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- -Number(0) | 1 | 0 | 0 | -Number(1) | 0 | 1 | 0 | -Number(2) | 0 | 0 | 1 | +Number(0) | True | False | False | +Number(1) | False | True | False | +Number(2) | False | False | True | ----------+-----------+-----------+-----------+- operator: != | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- -Number(0) | 0 | 1 | 1 | -Number(1) | 1 | 0 | 1 | -Number(2) | 1 | 1 | 0 | +Number(0) | False | True | True | +Number(1) | True | False | True | +Number(2) | True | True | False | ----------+-----------+-----------+-----------+- operator: > | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- -Number(0) | 0 | 0 | 0 | -Number(1) | 1 | 0 | 0 | -Number(2) | 1 | 1 | 0 | +Number(0) | False | False | False | +Number(1) | True | False | False | +Number(2) | True | True | False | ----------+-----------+-----------+-----------+- operator: >= | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- -Number(0) | 1 | 0 | 0 | -Number(1) | 1 | 1 | 0 | -Number(2) | 1 | 1 | 1 | +Number(0) | True | False | False | +Number(1) | True | True | False | +Number(2) | True | True | True | ----------+-----------+-----------+-----------+- ************************************************** -Vector([0, 1, 2, 3, 4]) < Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 0, 0]) -Vector([0, 1, 2, 3, 4]) < [2, 2, 2, 2, 2] -> Vector([1, 1, 0, 0, 0]) - [0, 1, 2, 3, 4] < Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 0, 0]) -Vector([0, 1, 2, 3, 4]) <= Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 1, 0, 0]) -Vector([0, 1, 2, 3, 4]) <= [2, 2, 2, 2, 2] -> Vector([1, 1, 1, 0, 0]) - [0, 1, 2, 3, 4] <= Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 1, 0, 0]) -Vector([0, 1, 2, 3, 4]) == Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 0, 0]) -Vector([0, 1, 2, 3, 4]) == [2, 2, 2, 2, 2] -> Vector([0, 0, 1, 0, 0]) - [0, 1, 2, 3, 4] == Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 0, 0]) -Vector([0, 1, 2, 3, 4]) != Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 1, 1]) -Vector([0, 1, 2, 3, 4]) != [2, 2, 2, 2, 2] -> Vector([1, 1, 0, 1, 1]) - [0, 1, 2, 3, 4] != Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 1, 1]) -Vector([0, 1, 2, 3, 4]) > Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 0, 1, 1]) -Vector([0, 1, 2, 3, 4]) > [2, 2, 2, 2, 2] -> Vector([0, 0, 0, 1, 1]) - [0, 1, 2, 3, 4] > Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 0, 1, 1]) -Vector([0, 1, 2, 3, 4]) >= Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 1, 1]) -Vector([0, 1, 2, 3, 4]) >= [2, 2, 2, 2, 2] -> Vector([0, 0, 1, 1, 1]) - [0, 1, 2, 3, 4] >= Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 1, 1]) +Vector([0, 1, 2, 3, 4]) < Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, False, False]) +Vector([0, 1, 2, 3, 4]) < [2, 2, 2, 2, 2] -> Vector([True, True, False, False, False]) + [0, 1, 2, 3, 4] < Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, False, False]) +Vector([0, 1, 2, 3, 4]) <= Vector([2, 2, 2, 2, 2]) -> Vector([True, True, True, False, False]) +Vector([0, 1, 2, 3, 4]) <= [2, 2, 2, 2, 2] -> Vector([True, True, True, False, False]) + [0, 1, 2, 3, 4] <= Vector([2, 2, 2, 2, 2]) -> Vector([True, True, True, False, False]) +Vector([0, 1, 2, 3, 4]) == Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, False, False]) +Vector([0, 1, 2, 3, 4]) == [2, 2, 2, 2, 2] -> Vector([False, False, True, False, False]) + [0, 1, 2, 3, 4] == Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, False, False]) +Vector([0, 1, 2, 3, 4]) != Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, True, True]) +Vector([0, 1, 2, 3, 4]) != [2, 2, 2, 2, 2] -> Vector([True, True, False, True, True]) + [0, 1, 2, 3, 4] != Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, True, True]) +Vector([0, 1, 2, 3, 4]) > Vector([2, 2, 2, 2, 2]) -> Vector([False, False, False, True, True]) +Vector([0, 1, 2, 3, 4]) > [2, 2, 2, 2, 2] -> Vector([False, False, False, True, True]) + [0, 1, 2, 3, 4] > Vector([2, 2, 2, 2, 2]) -> Vector([False, False, False, True, True]) +Vector([0, 1, 2, 3, 4]) >= Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, True, True]) +Vector([0, 1, 2, 3, 4]) >= [2, 2, 2, 2, 2] -> Vector([False, False, True, True, True]) + [0, 1, 2, 3, 4] >= Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, True, True]) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index dd85168..8d8c276 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2329,7 +2329,7 @@ def descrdoc(): if verbose: print "Testing descriptor doc strings..." def check(descr, what): vereq(descr.__doc__, what) - check(file.closed, "flag set if the file is closed") # getset descriptor + check(file.closed, "True if the file is closed") # getset descriptor check(file.name, "file name") # member descriptor def setclass(): diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py index ee19fa3..2c93b7e 100644 --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -48,7 +48,7 @@ Here's the new type at work: >>> print a.__class__ # show its class <class 'test.test_descrtut.defaultdict'> >>> print type(a) is a.__class__ # its type is its class - 1 + True >>> a[1] = 3.25 # modify the instance >>> print a # show the new value {1: 3.25} @@ -98,14 +98,14 @@ just like classic classes: >>> print a["noway"] -1000 >>> 'default' in dir(a) - 1 + True >>> a.x1 = 100 >>> a.x2 = 200 >>> print a.x1 100 >>> d = dir(a) >>> 'default' in d and 'x1' in d and 'x2' in d - 1 + True >>> print a.__dict__ {'default': -1000, 'x2': 200, 'x1': 100} >>> @@ -167,11 +167,11 @@ For instance of built-in types, x.__class__ is now the same as type(x): >>> list <type 'list'> >>> isinstance([], list) - 1 + True >>> isinstance([], dict) - 0 + False >>> isinstance([], object) - 1 + True >>> Under the new proposal, the __methods__ attribute no longer exists: diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index fb92ef4..77c477f 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -386,10 +386,10 @@ From the Iterators list, about the types of these things. >>> print i.next.__doc__ x.next() -> the next value, or raise StopIteration >>> iter(i) is i -1 +True >>> import types >>> isinstance(i, types.GeneratorType) -1 +True And more, added later. @@ -1218,16 +1218,16 @@ generated sequence, you need to copy its results. >>> for n in range(10): ... all = list(gencopy(conjoin([lambda: iter((0, 1))] * n))) ... print n, len(all), all[0] == [0] * n, all[-1] == [1] * n -0 1 1 1 -1 2 1 1 -2 4 1 1 -3 8 1 1 -4 16 1 1 -5 32 1 1 -6 64 1 1 -7 128 1 1 -8 256 1 1 -9 512 1 1 +0 1 True True +1 2 True True +2 4 True True +3 8 True True +4 16 True True +5 32 True True +6 64 True True +7 128 True True +8 256 True True +9 512 True True And run an 8-queens solver. diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 9aa5948..9ee7a39 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -167,34 +167,34 @@ test('replace', u'one!two!three!', u'one@two@three@', u'!', u'@') test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@') test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2) -test('startswith', u'hello', 1, u'he') -test('startswith', u'hello', 1, u'hello') -test('startswith', u'hello', 0, u'hello world') -test('startswith', u'hello', 1, u'') -test('startswith', u'hello', 0, u'ello') -test('startswith', u'hello', 1, u'ello', 1) -test('startswith', u'hello', 1, u'o', 4) -test('startswith', u'hello', 0, u'o', 5) -test('startswith', u'hello', 1, u'', 5) -test('startswith', u'hello', 0, u'lo', 6) -test('startswith', u'helloworld', 1, u'lowo', 3) -test('startswith', u'helloworld', 1, u'lowo', 3, 7) -test('startswith', u'helloworld', 0, u'lowo', 3, 6) - -test('endswith', u'hello', 1, u'lo') -test('endswith', u'hello', 0, u'he') -test('endswith', u'hello', 1, u'') -test('endswith', u'hello', 0, u'hello world') -test('endswith', u'helloworld', 0, u'worl') -test('endswith', u'helloworld', 1, u'worl', 3, 9) -test('endswith', u'helloworld', 1, u'world', 3, 12) -test('endswith', u'helloworld', 1, u'lowo', 1, 7) -test('endswith', u'helloworld', 1, u'lowo', 2, 7) -test('endswith', u'helloworld', 1, u'lowo', 3, 7) -test('endswith', u'helloworld', 0, u'lowo', 4, 7) -test('endswith', u'helloworld', 0, u'lowo', 3, 8) -test('endswith', u'ab', 0, u'ab', 0, 1) -test('endswith', u'ab', 0, u'ab', 0, 0) +test('startswith', u'hello', True, u'he') +test('startswith', u'hello', True, u'hello') +test('startswith', u'hello', False, u'hello world') +test('startswith', u'hello', True, u'') +test('startswith', u'hello', False, u'ello') +test('startswith', u'hello', True, u'ello', 1) +test('startswith', u'hello', True, u'o', 4) +test('startswith', u'hello', False, u'o', 5) +test('startswith', u'hello', True, u'', 5) +test('startswith', u'hello', False, u'lo', 6) +test('startswith', u'helloworld', True, u'lowo', 3) +test('startswith', u'helloworld', True, u'lowo', 3, 7) +test('startswith', u'helloworld', False, u'lowo', 3, 6) + +test('endswith', u'hello', True, u'lo') +test('endswith', u'hello', False, u'he') +test('endswith', u'hello', True, u'') +test('endswith', u'hello', False, u'hello world') +test('endswith', u'helloworld', False, u'worl') +test('endswith', u'helloworld', True, u'worl', 3, 9) +test('endswith', u'helloworld', True, u'world', 3, 12) +test('endswith', u'helloworld', True, u'lowo', 1, 7) +test('endswith', u'helloworld', True, u'lowo', 2, 7) +test('endswith', u'helloworld', True, u'lowo', 3, 7) +test('endswith', u'helloworld', False, u'lowo', 4, 7) +test('endswith', u'helloworld', False, u'lowo', 3, 8) +test('endswith', u'ab', False, u'ab', 0, 1) +test('endswith', u'ab', False, u'ab', 0, 0) test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi', 8) @@ -286,50 +286,50 @@ test('ljust', u'abc', u'abc', 2) test('rjust', u'abc', u'abc', 2) test('center', u'abc', u'abc', 2) -test('islower', u'a', 1) -test('islower', u'A', 0) -test('islower', u'\n', 0) -test('islower', u'\u1FFc', 0) -test('islower', u'abc', 1) -test('islower', u'aBc', 0) -test('islower', u'abc\n', 1) - -test('isupper', u'a', 0) -test('isupper', u'A', 1) -test('isupper', u'\n', 0) +test('islower', u'a', True) +test('islower', u'A', False) +test('islower', u'\n', False) +test('islower', u'\u1FFc', False) +test('islower', u'abc', True) +test('islower', u'aBc', False) +test('islower', u'abc\n', True) + +test('isupper', u'a', False) +test('isupper', u'A', True) +test('isupper', u'\n', False) if sys.platform[:4] != 'java': - test('isupper', u'\u1FFc', 0) -test('isupper', u'ABC', 1) -test('isupper', u'AbC', 0) -test('isupper', u'ABC\n', 1) - -test('istitle', u'a', 0) -test('istitle', u'A', 1) -test('istitle', u'\n', 0) -test('istitle', u'\u1FFc', 1) -test('istitle', u'A Titlecased Line', 1) -test('istitle', u'A\nTitlecased Line', 1) -test('istitle', u'A Titlecased, Line', 1) -test('istitle', u'Greek \u1FFcitlecases ...', 1) -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('isupper', u'\u1FFc', False) +test('isupper', u'ABC', True) +test('isupper', u'AbC', False) +test('isupper', u'ABC\n', True) + +test('istitle', u'a', False) +test('istitle', u'A', True) +test('istitle', u'\n', False) +test('istitle', u'\u1FFc', True) +test('istitle', u'A Titlecased Line', True) +test('istitle', u'A\nTitlecased Line', True) +test('istitle', u'A Titlecased, Line', True) +test('istitle', u'Greek \u1FFcitlecases ...', True) +test('istitle', u'Not a capitalized String', False) +test('istitle', u'Not\ta Titlecase String', False) +test('istitle', u'Not--a Titlecase String', False) + +test('isalpha', u'a', True) +test('isalpha', u'A', True) +test('isalpha', u'\n', False) +test('isalpha', u'\u1FFc', True) +test('isalpha', u'abc', True) +test('isalpha', u'aBc123', False) +test('isalpha', u'abc\n', False) + +test('isalnum', u'a', True) +test('isalnum', u'A', True) +test('isalnum', u'\n', False) +test('isalnum', u'123abc456', True) +test('isalnum', u'a1b3c', True) +test('isalnum', u'aBc000 ', False) +test('isalnum', u'abc\n', False) 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']) @@ -337,7 +337,7 @@ test('splitlines', u"abc\ndef\r\nghi", [u'abc', u'def', u'ghi']) test('splitlines', u"abc\ndef\r\nghi\n", [u'abc', u'def', u'ghi']) test('splitlines', u"abc\ndef\r\nghi\n\r", [u'abc', u'def', u'ghi', u'']) test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'', u'abc', u'def', u'ghi', u'']) -test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'\n', u'abc\n', u'def\r\n', u'ghi\n', u'\r'], 1) +test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'\n', u'abc\n', u'def\r\n', u'ghi\n', u'\r'], True) test('translate', u"abababc", u'bbbc', {ord('a'):None}) test('translate', u"abababc", u'iiic', {ord('a'):None, ord('b'):ord('i')}) |