code: def test_error_invalid_values(
      data, all_arithmetic_operators, using_infer_string
  ):
      op = all_arithmetic_operators
      s = pd.Series(data)
      ops = getattr(s, op)
  
      if using_infer_string:
          import pyarrow as pa
  
          errs = (
              TypeError,
              pa.lib.ArrowNotImplementedError,
              NotImplementedError,
          )
      else:
          errs = TypeError
  
      # invalid scalars
      msg = "|".join(
          [
              r"can only perform ops with numeric values",
              r"IntegerArray cannot perform the operation mod",
              r"unsupported operand type",
              r"can only concatenate str \(not \"int\"\) to str",
              "not all arguments converted during string",
              "ufunc '.*' not supported for the input types, and the inputs could not",
              "ufunc '.*' did not contain a loop with signature matching types",
              "Addition/subtraction of integers and integer-arrays with Timestamp",
              "has no kernel",
              "not implemented",
          ]
      )
      with pytest.raises(errs, match=msg):
          ops("foo")
      with pytest.raises(errs, match=msg):
          ops(pd.Timestamp("20180101"))
  
      # invalid array-likes
      str_ser = pd.Series("foo", index=s.index)
      # with pytest.raises(TypeError, match=msg):
      if (
          all_arithmetic_operators
          in [
              "__mul__",
              "__rmul__",
          ]
          and not using_infer_string
      ):  # (data[~data.isna()] >= 0).all():
          res = ops(str_ser)
          expected = pd.Series(["foo" * x for x in data], index=s.index)
          expected = expected.fillna(np.nan)
          # TODO: doing this fillna to keep tests passing as we make
          #  assert_almost_equal stricter, but the expected with pd.NA seems
          #  more-correct than np.nan here.
          tm.assert_series_equal(res, expected)
      else:
          with pytest.raises(errs, match=msg):
              ops(str_ser)
  
      msg = "|".join(
          [
              "can only perform ops with numeric values",
              "cannot perform .* with this index type: DatetimeArray",
              "Addition/subtraction of integers and integer-arrays "
              "with DatetimeArray is no longer supported. *",
              "unsupported operand type",
              r"can only concatenate str \(not \"int\"\) to str",
              "not all arguments converted during string",
              "cannot subtract DatetimeArray from ndarray",
              "has no kernel",
              "not implemented",
          ]
      )
      with pytest.raises(errs, match=msg):
          ops(pd.Series(pd.date_range("20180101", periods=len(s))))
  
imports: import operator
  import numpy
  import pytest
  import pandas
  import pandas._testing
  from pandas.core import ops
  from pandas.core.arrays import FloatingArray
label_desc: Use image node_id 12 for calling a global function with example usage: test_error_invalid_values(data, all_arithmetic_operators, using_infer_string) without return types