code: def test_chain_df(df):
      """Test expand_grid in a method-chain operation."""
      A = df["a"]
      B = df[["cities"]]
      others = {"A": A}
      result = B.expand_grid(df_key="city", others=others)
      A = df.loc[:, ["a"]]
      expected = B.assign(key=1).merge(A.assign(key=1), on="key")
      expected = expected.drop(columns="key")
      expected.columns = pd.MultiIndex.from_arrays(
          [["city", "A"], 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 23 for calling a global function with example usage: test_chain_df(df) without return types