Author: Brian Kearns <[email protected]>
Branch:
Changeset: r60998:481f9cde9e3e
Date: 2013-02-08 22:09 -0500
http://bitbucket.org/pypy/pypy/changeset/481f9cde9e3e/
Log: add numpy.bool/int aliases, test (fixes issue1161)
diff --git a/pypy/module/micronumpy/__init__.py
b/pypy/module/micronumpy/__init__.py
--- a/pypy/module/micronumpy/__init__.py
+++ b/pypy/module/micronumpy/__init__.py
@@ -27,6 +27,9 @@
'True_': 'types.Bool.True',
'False_': 'types.Bool.False',
+ 'bool': 'space.w_bool',
+ 'int': 'space.w_int',
+
'typeinfo': 'interp_dtype.get_dtype_cache(space).w_typeinfo',
'generic': 'interp_boxes.W_GenericBox',
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
@@ -494,7 +494,7 @@
def test_complex_format(self):
import _numpypy as numpy
-
+
for complex_ in (numpy.complex128, numpy.complex64,):
for real, imag, should in [
(1, 2, '(1+2j)'),
@@ -505,13 +505,13 @@
#xxx
#(numpy.inf, numpy.inf, '(inf+inf*j)'),
]:
-
+
c = complex_(complex(real, imag))
assert c == complex(real, imag)
assert c.real == real
assert c.imag == imag
assert repr(c) == should
-
+
real, imag, should = (1e100, 3e66, '(1e+100+3e+66j)')
c128 = numpy.complex128(complex(real, imag))
assert type(c128.real) is type(c128.imag) is numpy.float64
@@ -547,8 +547,6 @@
assert d.kind == 'c'
assert d.num == 14
assert d.char == 'F'
-
-
def test_subclass_type(self):
import _numpypy as numpy
@@ -580,6 +578,9 @@
def test_various_types(self):
import _numpypy as numpy
+ assert numpy.bool is bool
+ assert numpy.int is int
+
assert numpy.int16 is numpy.short
assert numpy.int8 is numpy.byte
assert numpy.bool_ is numpy.bool8
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit