@@ -309,14 +309,14 @@ def test_constructor_dtype_nocast_view_2d_array(
309
309
def test_1d_object_array_does_not_copy (self ):
310
310
# https://github.com/pandas-dev/pandas/issues/39272
311
311
arr = np .array (["a" , "b" ], dtype = "object" )
312
- df = DataFrame (arr )
312
+ df = DataFrame (arr , copy = False )
313
313
assert np .shares_memory (df .values , arr )
314
314
315
315
@td .skip_array_manager_invalid_test
316
316
def test_2d_object_array_does_not_copy (self ):
317
317
# https://github.com/pandas-dev/pandas/issues/39272
318
318
arr = np .array ([["a" , "b" ], ["c" , "d" ]], dtype = "object" )
319
- df = DataFrame (arr )
319
+ df = DataFrame (arr , copy = False )
320
320
assert np .shares_memory (df .values , arr )
321
321
322
322
def test_constructor_dtype_list_data (self ):
@@ -2107,13 +2107,18 @@ def test_constructor_frame_shallow_copy(self, float_frame):
2107
2107
cop .index = np .arange (len (cop ))
2108
2108
tm .assert_frame_equal (float_frame , orig )
2109
2109
2110
- def test_constructor_ndarray_copy (self , float_frame , using_array_manager ):
2110
+ def test_constructor_ndarray_copy (
2111
+ self , float_frame , using_array_manager , using_copy_on_write
2112
+ ):
2111
2113
if not using_array_manager :
2112
2114
arr = float_frame .values .copy ()
2113
2115
df = DataFrame (arr )
2114
2116
2115
2117
arr [5 ] = 5
2116
- assert (df .values [5 ] == 5 ).all ()
2118
+ if using_copy_on_write :
2119
+ assert not (df .values [5 ] == 5 ).all ()
2120
+ else :
2121
+ assert (df .values [5 ] == 5 ).all ()
2117
2122
2118
2123
df = DataFrame (arr , copy = True )
2119
2124
arr [6 ] = 6
0 commit comments