code: def test_from_frame_valid_names(names_in, names_out):
      # GH 22420
      df = pd.DataFrame(
          [["a", "a"], ["a", "b"], ["b", "a"], ["b", "b"]],
          columns=MultiIndex.from_tuples([("L1", "x"), ("L2", "y")]),
      )
      mi = MultiIndex.from_frame(df, names=names_in)
      assert mi.names == names_out
  
imports: from datetime import date, datetime
  import itertools
  import numpy
  import pytest
  from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
  import pandas
  from pandas import Index, MultiIndex, Series, Timestamp, date_range
  import pandas._testing
label_desc: Use image node_id 41 for calling a global function with example usage: test_from_frame_valid_names(names_in, names_out) without return types