code: def test_astype_float_to_uint_negatives_raise(
      self, float_numpy_dtype, any_unsigned_int_numpy_dtype
  ):
      # GH#45151 We don't cast negative numbers to nonsense values
      # TODO: same for EA float/uint dtypes, signed integers?
      arr = (
          np.arange(5).astype(float_numpy_dtype) - 3
      )  # includes negatives
      ser = Series(arr)
  
      msg = "Cannot losslessly cast from .* to .*"
      with pytest.raises(ValueError, match=msg):
          ser.astype(any_unsigned_int_numpy_dtype)
  
      with pytest.raises(ValueError, match=msg):
          ser.to_frame().astype(any_unsigned_int_numpy_dtype)
  
      with pytest.raises(ValueError, match=msg):
          # We currently catch and re-raise in Index.astype
          Index(ser).astype(any_unsigned_int_numpy_dtype)
  
      with pytest.raises(ValueError, match=msg):
          ser.array.astype(any_unsigned_int_numpy_dtype)
  
imports: from datetime import datetime, timedelta
  from importlib import reload
  import string
  import sys
  import numpy
  import pytest
  from pandas._libs.tslibs import iNaT
  import pandas.util._test_decorators
  from pandas import NA, Categorical, CategoricalDtype, DatetimeTZDtype, Index, Interval, NaT, Series, Timedelta, Timestamp, cut, date_range, to_datetime
  import pandas._testing
label_desc: Use image node_id 22 for calling the TestAstype obj's underlying member method code with example usage: obj.test_astype_float_to_uint_negatives_raise(float_numpy_dtype, any_unsigned_int_numpy_dtype) without return types