code: def test_multiindex(df):
      """Test expand_grid output for a pandas MultiIndex with a name."""
      A = df["names"]
      base = df.loc[:, ["numbers"]].assign(num=df.numbers * 4)
      B = pd.MultiIndex.from_frame(base)
      others = {"A": A, "B": B}
      result = expand_grid(others=others)
      A = df.loc[:, ["names"]]
      B = base.copy()
      expected = A.merge(B, how="cross")
      expected.columns = pd.MultiIndex.from_arrays(
          [["A", "B", "B"], expected.columns]
      )
      assert_frame_equal(result, expected)
  
imports: from functools import reduce
  import numpy
  import pandas
  import pytest
  from hypothesis import given, settings
  from pandas.testing import assert_frame_equal
  import janitor
  from janitor.functions.expand_grid import expand_grid
  from janitor.testing_utils.strategies import categoricaldf_strategy, df_strategy
label_desc: Use image node_id 18 for calling a global function with example usage: test_multiindex(df) without return types