code: def test_unpivot():
      frame = pd.DataFrame(
          {"x": range(10), "y": range(10), "z": range(10)}
      )
      df = unpivot_frame(frame, var_name="foo", value_name="bar")
      assert list(df.columns) == ["index", "foo", "bar"]
      assert set(pd.unique(df["foo"])) == {"x", "y", "z"}
  
      df = unpivot_frame(frame, x="x")
      assert list(df.columns) == ["x", "variable", "value"]
      assert set(pd.unique(df["variable"])) == {"y", "z"}
  
      df = unpivot_frame(frame, y="y")
      assert list(df.columns) == ["index", "variable", "value"]
      assert set(pd.unique(df["variable"])) == {"y"}
  
      df = unpivot_frame(frame, y=("y", "z"))
      assert list(df.columns) == ["index", "variable", "value"]
      assert set(pd.unique(df["variable"])) == {"y", "z"}
  
      df = unpivot_frame(frame, x=("x", "y"), y="z")
      assert list(df.columns) == ["x", "y", "variable", "value"]
      assert set(pd.unique(df["variable"])) == {"z"}
  
imports: import pytest
  import pandas
  import numpy
  from pdvega._utils import infer_vegalite_type, unpivot_frame, validate_aggregation
label_desc: Use image node_id 2 for calling a global function with example usage: test_unpivot() without return types