code: def test_write_fspath_hdf5(self):
      # Same test as write_fspath_all, except HDF5 files aren't
      # necessarily byte-for-byte identical for a given dataframe, so we'll
      # have to read and compare equality
      pytest.importorskip("tables")
  
      df = pd.DataFrame({"A": [1, 2]})
      p1 = tm.ensure_clean("string")
      p2 = tm.ensure_clean("fspath")
  
      with p1 as string, p2 as fspath:
          mypath = CustomFSPath(fspath)
          df.to_hdf(mypath, key="bar")
          df.to_hdf(string, key="bar")
  
          result = pd.read_hdf(fspath, key="bar")
          expected = pd.read_hdf(string, key="bar")
  
      tm.assert_frame_equal(result, expected)
  
imports: import codecs
  import errno
  from functools import partial
  from io import BytesIO, StringIO, UnsupportedOperation
  import mmap
  import os
  from pathlib import Path
  import pickle
  import tempfile
  import numpy
  import pytest
  from pandas.compat import is_platform_windows
  import pandas.util._test_decorators
  import pandas
  import pandas._testing
  import pandas.io.common
label_desc: Use image node_id 18 for calling the TestCommonIOCapabilities obj's underlying member method code with example usage: obj.test_write_fspath_hdf5() without return types