code: def test_astype_cast_nan_inf_int(self, val, any_int_numpy_dtype):
      # see GH#14265
      #
      # Check NaN and inf --> raise error when converting to int.
      msg = (
          "Cannot convert non-finite values \\(NA or inf\\) to integer"
      )
      df = DataFrame([val])
  
      with pytest.raises(ValueError, match=msg):
          df.astype(any_int_numpy_dtype)
  
imports: import re
  import numpy
  import pytest
  import pandas.util._test_decorators
  import pandas
  from pandas import Categorical, CategoricalDtype, DataFrame, DatetimeTZDtype, Index, Interval, IntervalDtype, NaT, Series, Timedelta, Timestamp, concat, date_range, option_context
  import pandas._testing
label_desc: Use image node_id 7 for calling the TestAstype obj's underlying member method code with example usage: obj.test_astype_cast_nan_inf_int(val, any_int_numpy_dtype) without return types