code: def test_astype_nan_raises(self):
      arr = SparseArray([1.0, np.nan])
      with pytest.raises(ValueError, match="Cannot convert non-finite"):
          arr.astype(int)
  
file_path: pandas/pandas/tests/arrays/sparse/test_astype.py
imports: import numpy
  import pytest
  from pandas._libs.sparse import IntIndex
  from pandas import SparseDtype, Timestamp
  import pandas._testing
  from pandas.core.arrays.sparse import SparseArray
label_desc: Use image node_id 5 for calling the TestAstype obj's underlying member method code with example usage: obj.test_astype_nan_raises() without return types