@@ -42,6 +42,7 @@ def for_all_dtypes_combination_bincount(names):
4242
4343
4444class TestHistogram (unittest .TestCase ):
45+
4546 @testing .for_all_dtypes (no_bool = True , no_complex = True )
4647 @testing .numpy_cupy_allclose (atol = 1e-6 , type_check = has_support_aspect64 ())
4748 def test_histogram (self , xp , dtype ):
@@ -94,7 +95,7 @@ def test_histogram_range_with_density(self, xp, dtype):
9495 return h
9596
9697 @testing .for_float_dtypes ()
97- @testing .numpy_cupy_allclose (atol = 1e-6 , type_check = False )
98+ @testing .numpy_cupy_allclose (atol = 1e-6 , type_check = has_support_aspect64 () )
9899 def test_histogram_range_with_weights_and_density (self , xp , dtype ):
99100 a = xp .arange (10 , dtype = dtype ) + 0.5
100101 w = xp .arange (10 , dtype = dtype ) + 0.5
@@ -135,7 +136,9 @@ def test_histogram_int_weights_dtype(self, xp, dtype):
135136 def test_histogram_float_weights_dtype (self , xp , dtype ):
136137 # Check the type of the returned histogram
137138 a = xp .arange (10 , dtype = dtype )
138- h , b = xp .histogram (a , weights = xp .ones (10 , dtype = xp .float32 ))
139+ h , b = xp .histogram (
140+ a , weights = xp .ones (10 , dtype = cupy .default_float_type ())
141+ )
139142 assert xp .issubdtype (h .dtype , xp .floating )
140143 return h
141144
@@ -363,6 +366,7 @@ def test_bincount_too_small_minlength(self, dtype):
363366 )
364367)
365368class TestDigitize :
369+
366370 @testing .for_all_dtypes (no_bool = True , no_complex = True )
367371 @testing .numpy_cupy_array_equal ()
368372 def test_digitize (self , xp , dtype ):
@@ -377,6 +381,7 @@ def test_digitize(self, xp, dtype):
377381
378382@testing .parameterize ({"right" : True }, {"right" : False })
379383class TestDigitizeNanInf (unittest .TestCase ):
384+
380385 @testing .numpy_cupy_array_equal ()
381386 def test_digitize_nan (self , xp ):
382387 x = testing .shaped_arange ((14 ,), xp , xp .float32 )
@@ -446,6 +451,7 @@ def test_searchsorted_minf(self, xp):
446451
447452
448453class TestDigitizeInvalid (unittest .TestCase ):
454+
449455 def test_digitize_complex (self ):
450456 for xp in (numpy , cupy ):
451457 x = testing .shaped_arange ((14 ,), xp , xp .complex64 )
@@ -462,6 +468,7 @@ def test_digitize_nd_bins(self):
462468
463469
464470@pytest .mark .skip ("histogramdd() is not implemented yet" )
471+ # @pytest.mark.skip(reason="XXX: NP2.0: histogramdd dtype")
465472@testing .parameterize (
466473 * testing .product (
467474 {
@@ -481,6 +488,7 @@ def test_digitize_nd_bins(self):
481488 )
482489)
483490class TestHistogramdd :
491+
484492 @testing .for_all_dtypes (no_bool = True , no_complex = True )
485493 @testing .numpy_cupy_allclose (atol = 1e-7 , rtol = 1e-7 )
486494 def test_histogramdd (self , xp , dtype ):
@@ -507,6 +515,7 @@ def test_histogramdd(self, xp, dtype):
507515
508516@pytest .mark .skip ("histogramdd() is not implemented yet" )
509517class TestHistogramddErrors (unittest .TestCase ):
518+
510519 def test_histogramdd_invalid_bins (self ):
511520 for xp in (numpy , cupy ):
512521 x = testing .shaped_random ((16 , 2 ), xp , scale = 100 )
@@ -552,6 +561,7 @@ def test_histogramdd_disallow_arraylike_bins(self):
552561
553562
554563@pytest .mark .skip ("histogram2d() is not implemented yet" )
564+ # @pytest.mark.skip(reason="XXX: NP2.0: histogram2d dtype")
555565@testing .parameterize (
556566 * testing .product (
557567 {
@@ -564,11 +574,13 @@ def test_histogramdd_disallow_arraylike_bins(self):
564574 )
565575)
566576class TestHistogram2d :
577+
567578 @testing .for_all_dtypes (no_bool = True , no_complex = True )
568- @testing .numpy_cupy_allclose (atol = 1e-7 , rtol = 1e-7 )
579+ @testing .numpy_cupy_allclose (atol = 1e-2 , rtol = 1e-7 )
569580 def test_histogram2d (self , xp , dtype ):
570581 x = testing .shaped_random ((100 ,), xp , dtype , scale = 100 )
571582 y = testing .shaped_random ((100 ,), xp , dtype , scale = 100 )
583+
572584 if self .bins == "array_list" :
573585 bins = [xp .arange (0 , 100 , 4 ), xp .arange (0 , 100 , 10 )]
574586 elif self .bins == "array" :
@@ -592,6 +604,7 @@ def test_histogram2d(self, xp, dtype):
592604
593605@pytest .mark .skip ("histogram2d() is not implemented yet" )
594606class TestHistogram2dErrors (unittest .TestCase ):
607+
595608 def test_histogram2d_disallow_arraylike_bins (self ):
596609 x = testing .shaped_random ((16 ,), cupy , scale = 100 )
597610 y = testing .shaped_random ((16 ,), cupy , scale = 100 )
0 commit comments