Commits

Brian Kearns committed 481f9cd

add numpy.bool/int aliases, test (fixes issue1161)

  • Participants
  • Parent commits a8d4721

Comments (0)

Files changed (2)

File pypy/module/micronumpy/__init__.py

         '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',

File pypy/module/micronumpy/test/test_dtypes.py

 
     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)'),
                 #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
         assert d.kind == 'c'
         assert d.num == 14
         assert d.char == 'F'
-        
-
 
     def test_subclass_type(self):
         import _numpypy as numpy
     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