code: def test_slice_irregular_datetime_index_with_nan(self):
      # GH36953
      index = pd.to_datetime(
          ["2012-01-01", "2012-01-02", "2012-01-03", None]
      )
      df = DataFrame(range(len(index)), index=index)
      expected = DataFrame(range(len(index[:3])), index=index[:3])
      with pytest.raises(
          KeyError, match="non-existing keys is not allowed"
      ):
          # Upper bound is not in index (which is unordered)
          # GH53983
          # GH37819
          df["2012-01-01":"2012-01-04"]
      # Need this precision for right bound since the right slice
      # bound is "rounded" up to the largest timepoint smaller than
      # the next "resolution"-step of the provided point.
      # e.g. 2012-01-03 is rounded up to 2012-01-04 - 1ns
      result = df["2012-01-01":"2012-01-03 00:00:00.000000000"]
      tm.assert_frame_equal(result, expected)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, Period, Series, Timestamp, date_range, period_range
  import pandas._testing
label_desc: Use image node_id 1 for calling the TestStringSlicing obj's underlying member method code with example usage: obj.test_slice_irregular_datetime_index_with_nan() without return types