code: def test_frame_plot_alpha(data, kind, info):
      cols = info["usecols"]
      kwds = info.get("kwds", {})
      data = data[cols]
  
      # if alpha is explicitly specified, then opacity should be in the spec
      chart = data.vgplot(kind=kind, alpha=0.5, **kwds)
      validate_vegalite(chart)
      assert chart["encoding"].to_dict()["opacity"]["value"] == 0.5
  
      if is_stackable(kind):
          # stackable plots have a default opacity when not stacked
          chart = data.vgplot(kind=kind, stacked=False, **kwds)
          validate_vegalite(chart)
          assert chart["encoding"].to_dict()["opacity"]["value"] == 0.7
  
          # if only one column is being plotted, then should have no opacity
          chart = data[cols[:1]].vgplot(
              kind=kind, stacked=False, **kwds
          )
          validate_vegalite(chart)
          assert "opacity" not in chart["encoding"].to_dict()
  
          # if stacked, then should have no opacity
          chart = data.vgplot(kind=kind, stacked=True, **kwds)
          validate_vegalite(chart)
          assert "opacity" not in chart["encoding"].to_dict()
      else:
          # non-stackable plots have no default opacity
          chart = data.vgplot(kind=kind, **kwds)
          validate_vegalite(chart)
          assert "opacity" not in chart["encoding"].to_dict()
  
file_path: pdvega/pdvega/tests/test_core_common.py
imports: import pytest
  import pandas
  import pdvega
  from .utils import validate_vegalite
label_desc: Use image node_id 7 for calling a global function with example usage: test_frame_plot_alpha(data, kind, info) without return types