[NumPy-Tickets] [NumPy] #1300: OverflowError when nan[arg]min or nan[arg]max called on unsigned integers

NumPy Trac numpy-tickets@scipy....
Wed May 26 08:51:31 CDT 2010


#1300: OverflowError when nan[arg]min or nan[arg]max called on unsigned integers
-----------------------+----------------------------------------------------
 Reporter:  tsyu       |       Owner:  somebody    
     Type:  defect     |      Status:  needs_review
 Priority:  normal     |   Milestone:  1.4.1       
Component:  numpy.lib  |     Version:  devel       
 Keywords:             |  
-----------------------+----------------------------------------------------

Comment(by tsyu):

 I'm not really sure what tests are appropriate. Here, I basically check
 that all numpy integer types are recognized as such.

 {{{
 Index: numpy/lib/tests/test_function_base.py
 ===================================================================
 --- numpy/lib/tests/test_function_base.py       (revision 8445)
 +++ numpy/lib/tests/test_function_base.py       (working copy)
 @@ -781,6 +781,38 @@
          assert_equal(np.isinf(a), np.zeros((2, 4), dtype=bool))


 +class TestNanFunctsIntTypes(TestCase):
 +
 +    int_types = (int8, int16, int32, int64, uint8, uint16, uint32,
 uint64)
 +
 +    def setUp(self, *args, **kwargs):
 +        self.A = array([127, 39,  93,  87, 46])
 +
 +    def integer_arrays(self):
 +        for dtype in self.int_types:
 +            yield self.A.astype(dtype)
 +
 +    def test_nanmin(self):
 +        min_value = min(self.A)
 +        for A in self.integer_arrays():
 +            assert_equal(nanmin(A), min_value)
 +
 +    def test_nanmax(self):
 +        max_value = max(self.A)
 +        for A in self.integer_arrays():
 +            assert_equal(nanmax(A), max_value)
 +
 +    def test_nanargmin(self):
 +        min_arg = argmin(self.A)
 +        for A in self.integer_arrays():
 +            assert_equal(nanargmin(A), min_arg)
 +
 +    def test_nanargmax(self):
 +        max_arg = argmax(self.A)
 +        for A in self.integer_arrays():
 +            assert_equal(nanargmax(A), max_arg)
 +
 +
  class TestCorrCoef(TestCase):
      def test_simple(self):
          A = array([[ 0.15391142, 0.18045767, 0.14197213],

 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1300#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list