[pypy-commit] pypy default: tests that old space.pos() implementation of conjugate() would have failed
gutworth
noreply at buildbot.pypy.org
Thu Jun 2 03:00:51 CEST 2011
Author: Benjamin Peterson <benjamin at python.org>
Branch:
Changeset: r44630:a740b2b9315a
Date: 2011-06-01 20:14 -0500
http://bitbucket.org/pypy/pypy/changeset/a740b2b9315a/
Log: tests that old space.pos() implementation of conjugate() would have
failed
diff --git a/pypy/objspace/std/test/test_floatobject.py b/pypy/objspace/std/test/test_floatobject.py
--- a/pypy/objspace/std/test/test_floatobject.py
+++ b/pypy/objspace/std/test/test_floatobject.py
@@ -71,6 +71,11 @@
pass
assert F(1.).conjugate() == 1.
+ class F(float):
+ def __pos__(self):
+ return 42.
+ assert F(1.).conjugate() == 1.
+
def test_negatives(self):
assert -1.1 < 0
assert -0.1 < 0
diff --git a/pypy/objspace/std/test/test_intobject.py b/pypy/objspace/std/test/test_intobject.py
--- a/pypy/objspace/std/test/test_intobject.py
+++ b/pypy/objspace/std/test/test_intobject.py
@@ -293,6 +293,11 @@
pass
assert I(1).conjugate() == 1
+ class I(int):
+ def __pos__(self):
+ return 42
+ assert I(1).conjugate() == 1
+
def test_trunc(self):
import math
assert math.trunc(1) == 1
diff --git a/pypy/objspace/std/test/test_longobject.py b/pypy/objspace/std/test/test_longobject.py
--- a/pypy/objspace/std/test/test_longobject.py
+++ b/pypy/objspace/std/test/test_longobject.py
@@ -300,6 +300,11 @@
assert type(L(7).conjugate()) is long
+ class L(long):
+ def __pos__(self):
+ return 43
+ assert L(7).conjugate() == 7L
+
def test_bit_length(self):
assert 8L.bit_length() == 4
assert (-1<<40).bit_length() == 41
More information about the pypy-commit
mailing list