code: def test_spark_stability_metrics(spark_context):
      spark_df = spark_context.createDataFrame(pytest.test_df)
  
      # generate metrics directly from spark dataframe
      features = ["date:isActive", "date:eyeColor", "date:latitude"]
      bin_specs = {
          "date": {
              "bin_width": pd.Timedelta(365, "days").value,
              "bin_offset": pd.Timestamp(
                  year=2000, month=1, day=1
              ).value,
          },
          "latitude": {"bin_width": 5.0, "bin_offset": 0.0},
      }
      ds = df_stability_metrics(
          spark_df,
          time_axis="date",
          features=features,
          binning="unit",
          bin_specs=bin_specs,
      )
  
      cols = ["profiles", "comparisons", "traffic_lights", "alerts"]
      for c in cols:
          assert c in list(ds.keys())
  
file_path: popmon/tests/popmon/spark/test_spark.py
imports: from copy import deepcopy
  from pathlib import Path
  import pandas
  import pytest
  from popmon.hist.filling import make_histograms
  from popmon.pipeline.metrics import df_stability_metrics
label_desc: Use image node_id 2 for calling a global function with example usage: test_spark_stability_metrics(spark_context) without return types