[pypy-commit] pypy default: cleanup
bdkearns
noreply at buildbot.pypy.org
Thu Dec 19 23:37:30 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r68497:df40c2b6928d
Date: 2013-12-19 17:36 -0500
http://bitbucket.org/pypy/pypy/changeset/df40c2b6928d/
Log: cleanup
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -478,8 +478,7 @@
assert numpy.int16('32768') == -32768
def test_uint16(self):
- import numpypy as numpy
-
+ import numpy
assert numpy.uint16(65535) == 65535
assert numpy.uint16(65536) == 0
assert numpy.uint16('65535') == 65535
@@ -487,8 +486,7 @@
def test_int32(self):
import sys
- import numpypy as numpy
-
+ import numpy
x = numpy.int32(23)
assert x == 23
assert numpy.int32(2147483647) == 2147483647
@@ -503,10 +501,8 @@
def test_uint32(self):
import sys
- import numpypy as numpy
-
+ import numpy
assert numpy.uint32(10) == 10
-
if sys.maxint > 2 ** 31 - 1:
assert numpy.uint32(4294967295) == 4294967295
assert numpy.uint32(4294967296) == 0
@@ -523,8 +519,7 @@
def test_int64(self):
import sys
- import numpypy as numpy
-
+ import numpy
if sys.maxint == 2 ** 63 -1:
assert numpy.int64.mro() == [numpy.int64, numpy.signedinteger,
numpy.integer, numpy.number,
@@ -539,30 +534,30 @@
assert numpy.int64(9223372036854775807) == 9223372036854775807
assert numpy.int64(9223372036854775807) == 9223372036854775807
-
raises(OverflowError, numpy.int64, 9223372036854775808)
raises(OverflowError, numpy.int64, 9223372036854775808L)
def test_uint64(self):
- import sys
- import numpypy as numpy
-
+ import numpy
+ assert numpy.dtype(numpy.uint64).type is numpy.uint64
assert numpy.uint64.mro() == [numpy.uint64, numpy.unsignedinteger,
numpy.integer, numpy.number,
numpy.generic, object]
-
- assert numpy.dtype(numpy.uint64).type is numpy.uint64
- skip("see comment")
- # These tests pass "by chance" on numpy, things that are larger than
- # platform long (i.e. a python int), don't get put in a normal box,
- # instead they become an object array containing a long, we don't have
- # yet, so these can't pass.
- assert numpy.uint64(9223372036854775808) == 9223372036854775808
- assert numpy.uint64(18446744073709551615) == 18446744073709551615
- raises(OverflowError, numpy.uint64(18446744073709551616))
+ import sys
+ if '__pypy__' not in sys.builtin_module_names:
+ # These tests pass "by chance" on numpy, things that are larger than
+ # platform long (i.e. a python int), don't get put in a normal box,
+ # instead they become an object array containing a long, we don't have
+ # yet, so these can't pass.
+ assert numpy.uint64(9223372036854775808) == 9223372036854775808
+ assert numpy.uint64(18446744073709551615) == 18446744073709551615
+ else:
+ raises(OverflowError, numpy.int64, 9223372036854775808)
+ raises(OverflowError, numpy.int64, 18446744073709551615)
+ raises(OverflowError, numpy.uint64, 18446744073709551616)
def test_float16(self):
- import numpypy as numpy
+ import numpy
assert numpy.float16.mro() == [numpy.float16, numpy.floating,
numpy.inexact, numpy.number,
numpy.generic, object]
@@ -573,8 +568,7 @@
def test_float32(self):
- import numpypy as numpy
-
+ import numpy
assert numpy.float32.mro() == [numpy.float32, numpy.floating,
numpy.inexact, numpy.number,
numpy.generic, object]
@@ -584,8 +578,7 @@
raises(ValueError, numpy.float32, '23.2df')
def test_float64(self):
- import numpypy as numpy
-
+ import numpy
assert numpy.float64.mro() == [numpy.float64, numpy.floating,
numpy.inexact, numpy.number,
numpy.generic, float, object]
@@ -601,14 +594,14 @@
raises(ValueError, numpy.float64, '23.2df')
def test_float_None(self):
- import numpypy as numpy
+ import numpy
from math import isnan
assert isnan(numpy.float32(None))
assert isnan(numpy.float64(None))
assert isnan(numpy.longdouble(None))
def test_longfloat(self):
- import numpypy as numpy
+ import numpy
# it can be float96 or float128
if numpy.longfloat != numpy.float64:
assert numpy.longfloat.mro()[1:] == [numpy.floating,
@@ -621,8 +614,7 @@
raises(ValueError, numpy.longfloat, '23.2df')
def test_complex_floating(self):
- import numpypy as numpy
-
+ import numpy
assert numpy.complexfloating.__mro__ == (numpy.complexfloating,
numpy.inexact, numpy.number, numpy.generic, object)
@@ -955,10 +947,14 @@
raises(KeyError, 'd.fields["xyz"]')
def test_create_from_dict(self):
- skip("not yet")
- from numpypy import dtype
- d = dtype({'names': ['a', 'b', 'c'],
- })
+ import numpy as np
+ import sys
+ d = {'names': ['r','g','b','a'],
+ 'formats': [np.uint8, np.uint8, np.uint8, np.uint8]}
+ if '__pypy__' not in sys.builtin_module_names:
+ dt = np.dtype(d)
+ else:
+ raises(NotImplementedError, np.dtype, d)
def test_create_subarrays(self):
from numpypy import dtype
More information about the pypy-commit
mailing list