code: def test_series_invalid_type(end):
      # see gh-6407
      msg = "cannot infer freq from a non-convertible dtype on a Series"
      s = Series(np.arange(end))
  
      with pytest.raises(TypeError, match=msg):
          frequencies.infer_freq(s)
  
imports: from datetime import datetime, timedelta
  import numpy
  import pytest
  from pandas._libs.tslibs.ccalendar import DAYS, MONTHS
  from pandas._libs.tslibs.offsets import _get_offset
  from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
  from pandas.compat import is_platform_windows
  from pandas import DatetimeIndex, Index, RangeIndex, Series, Timestamp, date_range, period_range
  import pandas._testing
  from pandas.core.arrays import DatetimeArray, TimedeltaArray
  from pandas.core.tools.datetimes import to_datetime
  from pandas.tseries import frequencies, offsets
label_desc: Use image node_id 28 for calling a global function with example usage: test_series_invalid_type(end) without return types