code: def test_select_with_dups(setup_path):
      # single dtypes
      df = DataFrame(
          np.random.default_rng(2).standard_normal((10, 4)),
          columns=["A", "A", "B", "B"],
      )
      df.index = date_range("20130101 9:30", periods=10, freq="min")
  
      with ensure_clean_store(setup_path) as store:
          store.append("df", df)
  
          result = store.select("df")
          expected = df
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
          result = store.select("df", columns=df.columns)
          expected = df
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
          result = store.select("df", columns=["A"])
          expected = df.loc[:, ["A"]]
          tm.assert_frame_equal(result, expected)
  
      # dups across dtypes
      df = concat(
          [
              DataFrame(
                  np.random.default_rng(2).standard_normal((10, 4)),
                  columns=["A", "A", "B", "B"],
              ),
              DataFrame(
                  np.random.default_rng(2)
                  .integers(0, 10, size=20)
                  .reshape(10, 2),
                  columns=["A", "C"],
              ),
          ],
          axis=1,
      )
      df.index = date_range("20130101 9:30", periods=10, freq="min")
  
      with ensure_clean_store(setup_path) as store:
          store.append("df", df)
  
          result = store.select("df")
          expected = df
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
          result = store.select("df", columns=df.columns)
          expected = df
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
          expected = df.loc[:, ["A"]]
          result = store.select("df", columns=["A"])
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
          expected = df.loc[:, ["B", "A"]]
          result = store.select("df", columns=["B", "A"])
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
      # duplicates on both index and columns
      with ensure_clean_store(setup_path) as store:
          store.append("df", df)
          store.append("df", df)
  
          expected = df.loc[:, ["B", "A"]]
          expected = concat([expected, expected])
          result = store.select("df", columns=["B", "A"])
          tm.assert_frame_equal(result, expected, by_blocks=True)
  
imports: import numpy
  import pytest
  from pandas._libs.tslibs import Timestamp
  import pandas
  from pandas import DataFrame, HDFStore, Index, MultiIndex, Series, _testing, bdate_range, concat, date_range, isna, read_hdf
  from pandas.tests.io.pytables.common import _maybe_remove, ensure_clean_store
  from pandas.io.pytables import Term
label_desc: Use image node_id 2 for calling a global function with example usage: test_select_with_dups(setup_path) without return types