@@ -188,6 +188,57 @@ def sdc_impl(a):
188188 with self .subTest (data = case ):
189189 np .testing .assert_array_equal (sdc_func (a ), ref_impl (a ))
190190
191+ def test_copy (self ):
192+ def ref_impl (a ):
193+ return np .copy (a )
194+
195+ def sdc_impl (a ):
196+ return numpy_like .copy (a )
197+
198+ sdc_func = self .jit (sdc_impl )
199+
200+ cases = [[5 , 2 , 0 , 333 , - 4 ], [3.3 , 5.4 , np .nan , 7.9 , np .nan ], [True , False , True ], ['a' , 'vv' , 'o12oo' ]]
201+ for case in cases :
202+ a = np .array (case )
203+ with self .subTest (data = case ):
204+ np .testing .assert_array_equal (sdc_func (a ), ref_impl (a ))
205+
206+ def test_copy_int (self ):
207+ def ref_impl ():
208+ a = np .array ([5 , 2 , 0 , 333 , - 4 ])
209+ return np .copy (a )
210+
211+ def sdc_impl ():
212+ a = np .array ([5 , 2 , 0 , 333 , - 4 ])
213+ return numpy_like .copy (a )
214+
215+ sdc_func = self .jit (sdc_impl )
216+ np .testing .assert_array_equal (sdc_func (), ref_impl ())
217+
218+ def test_copy_bool (self ):
219+ def ref_impl ():
220+ a = np .array ([True , False , True ])
221+ return np .copy (a )
222+
223+ def sdc_impl ():
224+ a = np .array ([True , False , True ])
225+ return numpy_like .copy (a )
226+
227+ sdc_func = self .jit (sdc_impl )
228+ np .testing .assert_array_equal (sdc_func (), ref_impl ())
229+
230+ @unittest .skip ("Numba doesn't have string array" )
231+ def test_copy_str (self ):
232+ def ref_impl ():
233+ a = np .array (['a' , 'vv' , 'o12oo' ])
234+ return np .copy (a )
235+
236+ def sdc_impl ():
237+ a = np .array (['a' , 'vv' , 'o12oo' ])
238+ return numpy_like .copy (a )
239+
240+ sdc_func = self .jit (sdc_impl )
241+ np .testing .assert_array_equal (sdc_func (), ref_impl ())
191242
192243class TestArrayReductions (TestCase ):
193244
0 commit comments