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/output | |
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/output')
-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 |
5 files changed, 81 insertions, 81 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]) |