code: def test_to_hdf_errors(tmp_path, format, setup_path):
      data = ["\ud800foo"]
      ser = Series(data, index=Index(data))
      path = tmp_path / setup_path
      # GH 20835
      ser.to_hdf(
          path, key="table", format=format, errors="surrogatepass"
      )
  
      result = read_hdf(path, "table", errors="surrogatepass")
      tm.assert_series_equal(result, ser)
  
imports: import contextlib
  import datetime
  import hashlib
  import tempfile
  import time
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, DatetimeIndex, Index, MultiIndex, Series, Timestamp, concat, date_range, period_range, timedelta_range
  import pandas._testing
  from pandas.tests.io.pytables.common import _maybe_remove, ensure_clean_store
  from pandas.io.pytables import HDFStore, read_hdf
label_desc: Use image node_id 12 for calling a global function with example usage: test_to_hdf_errors(tmp_path, format, setup_path) without return types