[pypy-commit] pypy kill-unary-multimethods: tests and fixes
fijal
noreply at buildbot.pypy.org
Fri Sep 23 17:56:35 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-unary-multimethods
Changeset: r47566:f0a75675a5ff
Date: 2011-09-23 17:56 +0200
http://bitbucket.org/pypy/pypy/changeset/f0a75675a5ff/
Log: tests and fixes
diff --git a/pypy/objspace/std/boolobject.py b/pypy/objspace/std/boolobject.py
--- a/pypy/objspace/std/boolobject.py
+++ b/pypy/objspace/std/boolobject.py
@@ -21,10 +21,12 @@
def unwrap(w_self, space):
return w_self.boolval
- int_w = unwrap
+
+ def int_w(w_self, space):
+ return int(w_self.boolval)
def uint_w(w_self, space):
- intval = w_self.intval
+ intval = int(w_self.boolval)
if intval < 0:
raise OperationError(space.w_ValueError,
space.wrap("cannot convert negative integer to unsigned"))
@@ -32,7 +34,7 @@
return r_uint(intval)
def bigint_w(w_self, space):
- return rbigint.fromint(w_self.intval)
+ return rbigint.fromint(int(w_self.boolval))
registerimplementation(W_BoolObject)
diff --git a/pypy/objspace/std/test/test_boolobject.py b/pypy/objspace/std/test/test_boolobject.py
--- a/pypy/objspace/std/test/test_boolobject.py
+++ b/pypy/objspace/std/test/test_boolobject.py
@@ -17,6 +17,12 @@
def test_false(self):
assert not self.space.is_true(self.false)
+
+ def test_uint_w(self):
+ assert self.space.uint_w(self.true) == 1
+
+ def test_rbigint_w(self):
+ assert self.space.bigint_w(self.true)._digits == [1]
class AppTestAppBoolTest:
def test_bool_callable(self):
More information about the pypy-commit
mailing list