code: def test_from_dataframe_allow_copy() -> None:
      # Zero copy only allowed when input is already a Polars dataframe
      df = pl.DataFrame({"a": [1, 2]})
      result = pl.from_dataframe(df, allow_copy=True)
      assert_frame_equal(result, df)
  
      df1_pandas = pd.DataFrame({"a": [1, 2]})
      result_from_pandas = pl.from_dataframe(
          df1_pandas, allow_copy=False
      )
      assert_frame_equal(result_from_pandas, df)
  
      # Zero copy cannot be guaranteed for other inputs at this time
      df2_pandas = pd.DataFrame({"a": ["A", "B"]})
      with pytest.raises(RuntimeError):
          pl.from_dataframe(df2_pandas, allow_copy=False)
  
imports: from __future__ import annotations
  from typing import Any
  import pandas
  import pyarrow
  import pytest
  import polars
  import polars.interchange.from_dataframe
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 7 for calling a global function with example usage: test_from_dataframe_allow_copy() without return types