Commits

Andrews Medina committed ec63aaa

implemented dtype.isnative.

  • Participants
  • Parent commits 8d8aa8c
  • Branches dtype-isnative

Comments (0)

Files changed (2)

File pypy/module/micronumpy/interp_dtype.py

     def descr_get_alignment(self, space):
         return space.wrap(self.itemtype.alignment)
 
+    def descr_get_isnative(self, space):
+        return space.wrap(self.native)
+
     def descr_get_base(self, space):
         return space.wrap(self.base)
 
     str = GetSetProperty(W_Dtype.descr_get_str),
     itemsize = GetSetProperty(W_Dtype.descr_get_itemsize),
     alignment = GetSetProperty(W_Dtype.descr_get_alignment),
+    isnative = GetSetProperty(W_Dtype.descr_get_isnative),
     shape = GetSetProperty(W_Dtype.descr_get_shape),
     name = interp_attrproperty('name', cls=W_Dtype),
     fields = GetSetProperty(W_Dtype.descr_get_fields),

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

         from numpypy import dtype
         assert dtype('i4').alignment == 4
 
+    def test_isnative(self):
+        from numpypy import dtype
+        assert dtype('i4').isnative == True
+        assert dtype('>i8').isnative == False
+
     def test_any_all(self):
         import numpypy as numpy
         x = numpy.bool_(True)