diff options
author | Jack Diederich <jackdied@gmail.com> | 2006-11-28 19:15:13 (GMT) |
---|---|---|
committer | Jack Diederich <jackdied@gmail.com> | 2006-11-28 19:15:13 (GMT) |
commit | 4dafcc4ece09c2a60473bb109513de4e7d2c2b11 (patch) | |
tree | 32be8af9dd16e1ea407bf008c92d62f7cd7539bd /Lib/test/test_descr.py | |
parent | dfc9d4f7aa38a3961847c034532e39f05a569f54 (diff) | |
download | cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.zip cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.gz cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.bz2 |
- patch #1600346 submitted by Tomer Filiba
- Renamed nb_nonzero slots to nb_bool
- Renamed __nonzero__ methods to __bool__
- update core, lib, docs, and tests to match
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index b2e7e66..d3ae455 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -417,8 +417,8 @@ def ints(): if verbose: print "Testing int operations..." numops(100, 3) # The following crashes in Python 2.2 - vereq((1).__nonzero__(), 1) - vereq((0).__nonzero__(), 0) + vereq((1).__bool__(), True) + vereq((0).__bool__(), False) # This returns 'NotImplemented' in Python 2.2 class C(int): def __add__(self, other): @@ -1682,7 +1682,7 @@ def specials(): class Proxy(object): def __init__(self, x): self.x = x - def __nonzero__(self): + def __bool__(self): return not not self.x def __hash__(self): return hash(self.x) @@ -1722,7 +1722,7 @@ def specials(): class DProxy(object): def __init__(self, x): self.x = x - def __nonzero__(self): + def __bool__(self): return not not self.x def __hash__(self): return hash(self.x) |