@@ -808,27 +808,29 @@ def test_basic_ufuncs(self):
808
808
809
809
def test_count_func (self ):
810
810
# Tests count
811
- ott = array ([0. , 1. , 2. , 3. ], mask = [1 , 0 , 0 , 0 ])
812
- ott1 = array ([0. , 1. , 2. , 3. ])
813
- if sys .version_info [0 ] >= 3 :
814
- self .assertTrue (isinstance (count (ott ), np .integer ))
815
- else :
816
- self .assertTrue (isinstance (count (ott ), int ))
817
- assert_equal (3 , count (ott ))
818
811
assert_equal (1 , count (1 ))
819
812
assert_equal (0 , array (1 , mask = [1 ]))
813
+
814
+ ott = array ([0. , 1. , 2. , 3. ], mask = [1 , 0 , 0 , 0 ])
815
+ res = count (ott )
816
+ self .assertTrue (res .dtype .type is np .intp )
817
+ assert_equal (3 , res )
818
+
820
819
ott = ott .reshape ((2 , 2 ))
821
- assert_ (isinstance (count (ott , 0 ), ndarray ))
822
- if sys .version_info [0 ] >= 3 :
823
- assert_ (isinstance (count (ott ), np .integer ))
824
- else :
825
- assert_ (isinstance (count (ott ), int ))
826
- assert_equal (3 , count (ott ))
827
- assert_ (getmask (count (ott , 0 )) is nomask )
828
- assert_equal ([1 , 2 ], count (ott , 0 ))
829
- assert_equal (type (count (ott , 0 )), type (count (ott1 , 0 )))
830
- assert_equal (count (ott , 0 ).dtype , count (ott1 , 0 ).dtype )
831
- assert_raises (IndexError , ott1 .count , 1 )
820
+ res = count (ott )
821
+ assert_ (res .dtype .type is np .intp )
822
+ assert_equal (3 , res )
823
+ res = count (ott , 0 )
824
+ assert_ (isinstance (res , ndarray ))
825
+ assert_equal ([1 , 2 ], res )
826
+ assert_ (getmask (res ) is nomask )
827
+
828
+ ott = array ([0. , 1. , 2. , 3. ])
829
+ res = count (ott , 0 )
830
+ assert_ (isinstance (res , ndarray ))
831
+ assert_ (res .dtype .type is np .intp )
832
+
833
+ assert_raises (IndexError , ott .count , 1 )
832
834
833
835
def test_minmax_func (self ):
834
836
# Tests minimum and maximum.
0 commit comments