code: def test_quantile(interpolation, a_vals, b_vals, q, request):
      if (
          interpolation == "nearest"
          and q == 0.5
          and isinstance(b_vals, list)
          and b_vals == [4, 3, 2, 1]
      ):
          request.applymarker(
              pytest.mark.xfail(
                  reason="Unclear numpy expectation for nearest "
                  "result with equidistant data"
              )
          )
      all_vals = pd.concat([pd.Series(a_vals), pd.Series(b_vals)])
  
      a_expected = pd.Series(a_vals).quantile(
          q, interpolation=interpolation
      )
      b_expected = pd.Series(b_vals).quantile(
          q, interpolation=interpolation
      )
  
      df = DataFrame(
          {
              "key": ["a"] * len(a_vals) + ["b"] * len(b_vals),
              "val": all_vals,
          }
      )
  
      expected = DataFrame(
          [a_expected, b_expected],
          columns=["val"],
          index=Index(["a", "b"], name="key"),
      )
      if (
          all_vals.dtype.kind == "M"
          and expected.dtypes.values[0].kind == "M"
      ):
          # TODO(non-nano): this should be unnecessary once array_to_datetime
          #  correctly infers non-nano from Timestamp.unit
          expected = expected.astype(all_vals.dtype)
      result = df.groupby("key").quantile(
          q, interpolation=interpolation
      )
  
      tm.assert_frame_equal(result, expected)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index
  import pandas._testing
label_desc: Use image node_id 1 for calling a global function with example usage: test_quantile(interpolation, a_vals, b_vals, q, request) without return types