@@ -7246,17 +7246,20 @@ def test_dot_out(self):
72467246
72477247 def test_view_assign (self ):
72487248 from numpy .core ._multiarray_tests import npy_create_writebackifcopy , npy_resolve
7249+
72497250 arr = np .arange (9 ).reshape (3 , 3 ).T
72507251 arr_wb = npy_create_writebackifcopy (arr )
72517252 assert_ (arr_wb .flags .writebackifcopy )
72527253 assert_ (arr_wb .base is arr )
7253- arr_wb [: ] = - 100
7254+ arr_wb [... ] = - 100
72547255 npy_resolve (arr_wb )
7256+ # arr changes after resolve, even though we assigned to arr_wb
72557257 assert_equal (arr , - 100 )
72567258 # after resolve, the two arrays no longer reference each other
7257- assert_ (not arr_wb .ctypes .data = = 0 )
7259+ assert_ (arr_wb .ctypes .data ! = 0 )
72587260 assert_equal (arr_wb .base , None )
7259- arr_wb [:] = 100
7261+ # assigning to arr_wb does not get transfered to arr
7262+ arr_wb [...] = 100
72607263 assert_equal (arr , - 100 )
72617264
72627265 def test_dealloc_warning (self ):
@@ -7269,23 +7272,25 @@ def test_dealloc_warning(self):
72697272
72707273 def test_view_discard_refcount (self ):
72717274 from numpy .core ._multiarray_tests import npy_create_writebackifcopy , npy_discard
7275+
72727276 arr = np .arange (9 ).reshape (3 , 3 ).T
72737277 orig = arr .copy ()
72747278 if HAS_REFCOUNT :
72757279 arr_cnt = sys .getrefcount (arr )
72767280 arr_wb = npy_create_writebackifcopy (arr )
72777281 assert_ (arr_wb .flags .writebackifcopy )
72787282 assert_ (arr_wb .base is arr )
7279- arr_wb [: ] = - 100
7283+ arr_wb [... ] = - 100
72807284 npy_discard (arr_wb )
72817285 # arr remains unchanged after discard
72827286 assert_equal (arr , orig )
72837287 # after discard, the two arrays no longer reference each other
7284- assert_ (not arr_wb .ctypes .data = = 0 )
7288+ assert_ (arr_wb .ctypes .data ! = 0 )
72857289 assert_equal (arr_wb .base , None )
72867290 if HAS_REFCOUNT :
72877291 assert_equal (arr_cnt , sys .getrefcount (arr ))
7288- arr_wb [:] = 100
7292+ # assigning to arr_wb does not get transfered to arr
7293+ arr_wb [...] = 100
72897294 assert_equal (arr , orig )
72907295
72917296
0 commit comments