@@ -72,3 +72,42 @@ def test_nanvar(array):
7272 expected = numpy .nanvar (a , axis = None , ddof = 0 )
7373 result = dpnp .nanvar (ia , axis = None , ddof = 0 )
7474 numpy .testing .assert_array_equal (expected , result )
75+
76+
77+ class TestBincount :
78+
79+ @pytest .mark .parametrize ("array" ,
80+ [[1 , 2 , 3 ],
81+ [1 , 2 , 2 , 1 , 2 , 4 ],
82+ [2 , 2 , 2 , 2 ]],
83+ ids = ['[1, 2, 3]' ,
84+ '[1, 2, 2, 1, 2, 4]' ,
85+ '[2, 2, 2, 2]' ])
86+ @pytest .mark .parametrize ("minlength" ,
87+ [0 , 1 , 3 , 5 ],
88+ ids = ['0' , '1' , '3' , '5' ])
89+ def test_bincount_minlength (self , array , minlength ):
90+ np_a = numpy .array (array )
91+ dpnp_a = dpnp .array (array )
92+
93+ expected = numpy .bincount (np_a , minlength = minlength )
94+ result = dpnp .bincount (dpnp_a , minlength = minlength )
95+ numpy .testing .assert_array_equal (expected , result )
96+
97+ @pytest .mark .parametrize ("array" ,
98+ [[1 , 2 , 2 , 1 , 2 , 4 ]],
99+ ids = ['[1, 2, 2, 1, 2, 4]' ])
100+ @pytest .mark .parametrize ("weights" ,
101+ [None ,
102+ [0.3 , 0.5 , 0.2 , 0.7 , 1. , - 0.6 ],
103+ [2 , 2 , 2 , 2 , 2 , 2 ]],
104+ ids = ['None' ,
105+ '[0.3, 0.5, 0.2, 0.7, 1., -0.6]' ,
106+ '[2, 2, 2, 2, 2, 2]' ])
107+ def test_bincount_weights (self , array , weights ):
108+ np_a = numpy .array (array )
109+ dpnp_a = dpnp .array (array )
110+
111+ expected = numpy .bincount (np_a , weights = weights )
112+ result = dpnp .bincount (dpnp_a , weights = weights )
113+ numpy .testing .assert_array_equal (expected , result )
0 commit comments