@@ -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
@@ -355,6 +358,7 @@ def test_bincount_too_small_minlength(self, dtype):
355358 )
356359)
357360class TestDigitize :
361+
358362 @testing .for_all_dtypes (no_bool = True , no_complex = True )
359363 @testing .numpy_cupy_array_equal ()
360364 def test_digitize (self , xp , dtype ):
@@ -369,6 +373,7 @@ def test_digitize(self, xp, dtype):
369373
370374@testing .parameterize ({"right" : True }, {"right" : False })
371375class TestDigitizeNanInf (unittest .TestCase ):
376+
372377 @testing .numpy_cupy_array_equal ()
373378 def test_digitize_nan (self , xp ):
374379 x = testing .shaped_arange ((14 ,), xp , xp .float32 )
@@ -438,6 +443,7 @@ def test_searchsorted_minf(self, xp):
438443
439444
440445class TestDigitizeInvalid (unittest .TestCase ):
446+
441447 def test_digitize_complex (self ):
442448 for xp in (numpy , cupy ):
443449 x = testing .shaped_arange ((14 ,), xp , xp .complex64 )
@@ -454,6 +460,7 @@ def test_digitize_nd_bins(self):
454460
455461
456462@pytest .mark .skip ("histogramdd() is not implemented yet" )
463+ # @pytest.mark.skip(reason="XXX: NP2.0: histogramdd dtype")
457464@testing .parameterize (
458465 * testing .product (
459466 {
@@ -473,6 +480,7 @@ def test_digitize_nd_bins(self):
473480 )
474481)
475482class TestHistogramdd :
483+
476484 @testing .for_all_dtypes (no_bool = True , no_complex = True )
477485 @testing .numpy_cupy_allclose (atol = 1e-7 , rtol = 1e-7 )
478486 def test_histogramdd (self , xp , dtype ):
@@ -499,6 +507,7 @@ def test_histogramdd(self, xp, dtype):
499507
500508@pytest .mark .skip ("histogramdd() is not implemented yet" )
501509class TestHistogramddErrors (unittest .TestCase ):
510+
502511 def test_histogramdd_invalid_bins (self ):
503512 for xp in (numpy , cupy ):
504513 x = testing .shaped_random ((16 , 2 ), xp , scale = 100 )
@@ -544,6 +553,7 @@ def test_histogramdd_disallow_arraylike_bins(self):
544553
545554
546555@pytest .mark .skip ("histogram2d() is not implemented yet" )
556+ # @pytest.mark.skip(reason="XXX: NP2.0: histogram2d dtype")
547557@testing .parameterize (
548558 * testing .product (
549559 {
@@ -556,11 +566,13 @@ def test_histogramdd_disallow_arraylike_bins(self):
556566 )
557567)
558568class TestHistogram2d :
569+
559570 @testing .for_all_dtypes (no_bool = True , no_complex = True )
560- @testing .numpy_cupy_allclose (atol = 1e-7 , rtol = 1e-7 )
571+ @testing .numpy_cupy_allclose (atol = 1e-2 , rtol = 1e-7 )
561572 def test_histogram2d (self , xp , dtype ):
562573 x = testing .shaped_random ((100 ,), xp , dtype , scale = 100 )
563574 y = testing .shaped_random ((100 ,), xp , dtype , scale = 100 )
575+
564576 if self .bins == "array_list" :
565577 bins = [xp .arange (0 , 100 , 4 ), xp .arange (0 , 100 , 10 )]
566578 elif self .bins == "array" :
@@ -584,6 +596,7 @@ def test_histogram2d(self, xp, dtype):
584596
585597@pytest .mark .skip ("histogram2d() is not implemented yet" )
586598class TestHistogram2dErrors (unittest .TestCase ):
599+
587600 def test_histogram2d_disallow_arraylike_bins (self ):
588601 x = testing .shaped_random ((16 ,), cupy , scale = 100 )
589602 y = testing .shaped_random ((16 ,), cupy , scale = 100 )
0 commit comments