code: def test_qcut_nat(ser, unit):
      # see gh-19768
      ser = Series(ser)
      ser = ser.dt.as_unit(unit)
      td = Timedelta(1, unit=unit).as_unit(unit)
  
      left = Series(
          [ser[0] - td, np.nan, ser[2] - Day()], dtype=ser.dtype
      )
      right = Series([ser[2] - Day(), np.nan, ser[2]], dtype=ser.dtype)
      intervals = IntervalIndex.from_arrays(left, right)
      expected = Series(Categorical(intervals, ordered=True))
  
      result = qcut(ser, 2)
      tm.assert_series_equal(result, expected)
  
imports: import os
  import numpy
  import pytest
  import pandas
  from pandas import Categorical, DatetimeIndex, Interval, IntervalIndex, NaT, Series, Timedelta, TimedeltaIndex, Timestamp, cut, date_range, isna, qcut, timedelta_range
  import pandas._testing
  from pandas.api.types import CategoricalDtype
  from pandas.tseries.offsets import Day
label_desc: Use image node_id 15 for calling a global function with example usage: test_qcut_nat(ser, unit) without return types