[pypy-commit] pypy py3k: merge heads
gutworth
noreply at buildbot.pypy.org
Mon Mar 12 21:47:23 CET 2012
Author: Benjamin Peterson <benjamin at python.org>
Branch: py3k
Changeset: r53342:96ebedda1f01
Date: 2012-03-12 13:46 -0700
http://bitbucket.org/pypy/pypy/changeset/96ebedda1f01/
Log: merge heads
diff --git a/pypy/module/__builtin__/test/test_functional.py b/pypy/module/__builtin__/test/test_functional.py
--- a/pypy/module/__builtin__/test/test_functional.py
+++ b/pypy/module/__builtin__/test/test_functional.py
@@ -171,16 +171,6 @@
assert list(reversed(list(reversed("hello")))) == ['h','e','l','l','o']
raises(TypeError, reversed, reversed("hello"))
-class AppTestApply:
- def test_apply(self):
- def f(*args, **kw):
- return args, kw
- args = (1,3)
- kw = {'a': 1, 'b': 4}
- assert apply(f) == ((), {})
- assert apply(f, args) == (args, {})
- assert apply(f, args, kw) == (args, kw)
-
class AppTestAllAny:
"""
These are copied directly and replicated from the Python 2.5 source code.
diff --git a/pypy/module/_random/interp_random.py b/pypy/module/_random/interp_random.py
--- a/pypy/module/_random/interp_random.py
+++ b/pypy/module/_random/interp_random.py
@@ -73,16 +73,6 @@
w_item = space.getitem(w_state, space.newint(rrandom.N))
self._rnd.index = space.int_w(w_item)
- def jumpahead(self, space, w_n):
- try:
- n = space.int_w(w_n)
- except OperationError, e:
- if not e.match(space, space.w_TypeError):
- raise
- num = space.bigint_w(w_n)
- n = intmask(num.uintmask())
- self._rnd.jumpahead(n)
-
assert rbigint.SHIFT <= 32
@unwrap_spec(k=int)
def getrandbits(self, space, k):
@@ -107,6 +97,5 @@
seed = interp2app(W_Random.seed),
getstate = interp2app(W_Random.getstate),
setstate = interp2app(W_Random.setstate),
- jumpahead = interp2app(W_Random.jumpahead),
getrandbits = interp2app(W_Random.getrandbits),
)
diff --git a/pypy/module/_random/test/test_random.py b/pypy/module/_random/test/test_random.py
--- a/pypy/module/_random/test/test_random.py
+++ b/pypy/module/_random/test/test_random.py
@@ -82,13 +82,6 @@
state2 = rnd.getstate() # seed() to improve the resolution)
assert state1 != state2
- def test_jumpahead(self):
- import sys
- import _random
- rnd = _random.Random()
- rnd.jumpahead(100)
- rnd.jumpahead(sys.maxint + 2)
-
def test_randbits(self):
import _random
rnd = _random.Random()
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
@@ -109,12 +109,10 @@
def test_int_float(self):
assert int(42.1234) == 42
- assert int(4e10) == 40000000000L
+ assert int(4e10) == 40000000000
raises(OverflowError, int, float('inf'))
- raises(OverflowError, long, float('inf'))
raises(ValueError, int, float('nan'))
- raises(ValueError, long, float('nan'))
def test_float_string(self):
assert 42 == float("42")
@@ -138,15 +136,15 @@
def test_float_unicode(self):
# u00A0 and u2000 are some kind of spaces
- assert 42.75 == float(unichr(0x00A0)+unicode("42.75")+unichr(0x2000))
- class FloatUnicode(unicode):
+ assert 42.75 == float(chr(0x00A0)+str("42.75")+chr(0x2000))
+ class FloatStr(str):
def __float__(self):
- return float(unicode(self)) + 1
- assert float(FloatUnicode("8")) == 9.0
+ return float(str(self)) + 1
+ assert float(FloatStr("8")) == 9.0
def test_float_long(self):
- assert 42.0 == float(42L)
- assert 10000000000.0 == float(10000000000L)
+ assert 42.0 == float(42)
+ assert 10000000000.0 == float(10000000000)
raises(OverflowError, float, 10**400)
def test_as_integer_ratio(self):
@@ -258,19 +256,19 @@
assert 4.3 > 2.3
assert 0.01 >= -0.01
# float+long
- verylonglong = 10L**400
+ verylonglong = 10**400
infinite = 1e200*1e200
- assert 12.0 == 12L
- assert 1e300 == long(1e300)
- assert 12.1 != 12L
- assert infinite != 123456789L
- assert 12.9 < 13L
- assert -infinite < -13L
- assert 12.9 <= 13L
- assert 13.0 <= 13L
- assert 13.01 > 13L
- assert 13.0 >= 13L
- assert 13.01 >= 13L
+ assert 12.0 == 12
+ assert 1e300 == (1e300)
+ assert 12.1 != 12
+ assert infinite != 123456789
+ assert 12.9 < 13
+ assert -infinite < -13
+ assert 12.9 <= 13
+ assert 13.0 <= 13
+ assert 13.01 > 13
+ assert 13.0 >= 13
+ assert 13.01 >= 13
assert 12.0 == 12
assert 12.1 != 12
assert infinite != 123456789
@@ -286,17 +284,17 @@
assert 1234.56 < verylonglong
assert 1234.56 <= verylonglong
# long+float
- assert 12L == 12.0
- assert long(1e300) == 1e300
- assert 12L != 12.1
- assert 123456789L != infinite
- assert 13L > 12.9
- assert -13L > -infinite
- assert 13L >= 12.9
- assert 13L >= 13.0
- assert 13L < 13.01
- assert 13L <= 13.0
- assert 13L <= 13.01
+ assert 12 == 12.0
+ assert int(1e300) == 1e300
+ assert 12 != 12.1
+ assert 123456789 != infinite
+ assert 13 > 12.9
+ assert -13 > -infinite
+ assert 13 >= 12.9
+ assert 13 >= 13.0
+ assert 13 < 13.01
+ assert 13 <= 13.0
+ assert 13 <= 13.01
assert verylonglong < infinite
assert verylonglong <= infinite
assert verylonglong > 1234.56
@@ -425,9 +423,9 @@
#if hasattr(int, '__eq__'): # for py.test -A: CPython is inconsistent
# assert 5 .__eq__(3.14) is NotImplemented
# assert 3.14 .__eq__(5) is False
- #if hasattr(long, '__eq__'): # for py.test -A: CPython is inconsistent
- # assert 5L .__eq__(3.14) is NotImplemented
- # assert 3.14 .__eq__(5L) is False
+ #if hasattr(int, '__eq__'): # for py.test -A: CPython is inconsistent
+ # assert 5 .__eq__(3.14) is NotImplemented
+ # assert 3.14 .__eq__(5) is False
def test_from_string(self):
raises(ValueError, float, "\0")
@@ -505,7 +503,7 @@
self.identical(fromHex('+0x1p0'), 1.0)
self.identical(fromHex('0x01p0'), 1.0)
self.identical(fromHex('0x1p00'), 1.0)
- self.identical(fromHex(u'0x1p0'), 1.0)
+ self.identical(fromHex('0x1p0'), 1.0)
self.identical(fromHex(' 0x1p0 '), 1.0)
self.identical(fromHex('\n 0x1p0'), 1.0)
self.identical(fromHex('0x1p0 \t'), 1.0)
@@ -760,7 +758,7 @@
# fromHex(toHex(x)) should exactly recover x, for any non-NaN float x.
import random
- for i in xrange(500):
+ for i in range(500):
e = random.randrange(-1200, 1200)
m = random.random()
s = random.choice([1.0, -1.0])
@@ -773,8 +771,6 @@
def test_invalid(self):
raises(ValueError, float.fromhex, "0P")
- # A fullwidth Unicode digit
- raises(ValueError, float.fromhex, "0x1p\uff10")
def test_division_edgecases(self):
import math
More information about the pypy-commit
mailing list