code: def test_setitem_with_view_invalidated_does_not_copy(
      using_copy_on_write, warn_copy_on_write, request
  ):
      df = DataFrame({"a": [1, 2, 3], "b": 1, "c": 1})
      view = df[:]
  
      df["b"] = 100
      arr = get_array(df, "a")
      view = None  # noqa: F841
      # TODO(CoW-warn) false positive? -> block gets split because of `df["b"] = 100`
      # which introduces additional refs, even when those of `view` go out of scopes
      with tm.assert_cow_warning(warn_copy_on_write):
          df.iloc[0, 0] = 100
      if using_copy_on_write:
          # Setitem split the block. Since the old block shared data with view
          # all the new blocks are referencing view and each other. When view
          # goes out of scope, they don't share data with any other block,
          # so we should not trigger a copy
          mark = pytest.mark.xfail(
              reason="blk.delete does not track references correctly"
          )
          request.applymarker(mark)
          assert np.shares_memory(arr, get_array(df, "a"))
  
file_path: pandas/pandas/tests/copy_view/test_core_functionalities.py
imports: import numpy
  import pytest
  from pandas import DataFrame
  import pandas._testing
  from pandas.tests.copy_view.util import get_array
label_desc: Use image node_id 4 for calling a global function with example usage: test_setitem_with_view_invalidated_does_not_copy(using_copy_on_write, warn_copy_on_write, request) without return types