@@ -1261,7 +1261,7 @@ def test_timestamp_cmp() -> None:
12611261 c_np_dt64 = np .datetime64 (1 , "ns" )
12621262 c_dt_datetime = dt .datetime (year = 2000 , month = 1 , day = 1 )
12631263 c_datetimeindex = pd .DatetimeIndex (["2000-1-1" ])
1264- # DatetimeIndex, but the type checker detects it to be Index[Unknown] .
1264+ # DatetimeIndex, but the type checker detects it to be UnknownIndex .
12651265 c_unknown_index = pd .DataFrame ({"a" : [1 ]}, index = c_datetimeindex ).index
12661266 c_np_ndarray_dt64 = np_dt64_arr
12671267 c_series_dt64 : TimestampSeries = pd .Series ([1 , 2 , 3 ], dtype = "datetime64[ns]" )
@@ -1304,6 +1304,8 @@ def test_timestamp_cmp() -> None:
13041304
13051305 check (assert_type (c_datetimeindex > ts , np_ndarray_bool ), np .ndarray , np .bool_ )
13061306 check (assert_type (c_datetimeindex <= ts , np_ndarray_bool ), np .ndarray , np .bool_ )
1307+ check (assert_type (c_unknown_index > ts , np_ndarray_bool ), np .ndarray , np .bool_ )
1308+ check (assert_type (c_unknown_index <= ts , np_ndarray_bool ), np .ndarray , np .bool_ )
13071309
13081310 check (assert_type (c_np_ndarray_dt64 > ts , np_ndarray_bool ), np .ndarray , np .bool_ )
13091311 check (assert_type (c_np_ndarray_dt64 <= ts , np_ndarray_bool ), np .ndarray , np .bool_ )
@@ -1346,6 +1348,8 @@ def test_timestamp_cmp() -> None:
13461348
13471349 check (assert_type (c_datetimeindex >= ts , np_ndarray_bool ), np .ndarray , np .bool_ )
13481350 check (assert_type (c_datetimeindex < ts , np_ndarray_bool ), np .ndarray , np .bool_ )
1351+ check (assert_type (c_unknown_index >= ts , np_ndarray_bool ), np .ndarray , np .bool_ )
1352+ check (assert_type (c_unknown_index < ts , np_ndarray_bool ), np .ndarray , np .bool_ )
13491353
13501354 check (assert_type (c_np_ndarray_dt64 >= ts , np_ndarray_bool ), np .ndarray , np .bool_ )
13511355 check (assert_type (c_np_ndarray_dt64 < ts , np_ndarray_bool ), np .ndarray , np .bool_ )
@@ -1417,6 +1421,8 @@ def test_timestamp_eq_ne_rhs() -> None:
14171421 c_np_dt64 = np .datetime64 (1 , "ns" )
14181422 c_dt_datetime = dt .datetime (year = 2000 , month = 1 , day = 1 )
14191423 c_datetimeindex = pd .DatetimeIndex (["2000-1-1" ])
1424+ # DatetimeIndex, but the type checker detects it to be UnknownIndex.
1425+ c_unknown_index = pd .DataFrame ({"a" : [1 ]}, index = c_datetimeindex ).index
14201426 c_np_ndarray_dt64 = np_dt64_arr
14211427 c_series_dt64 : pd .Series [pd .Timestamp ] = pd .Series (
14221428 [1 , 2 , 3 ], dtype = "datetime64[ns]"
@@ -1437,6 +1443,13 @@ def test_timestamp_eq_ne_rhs() -> None:
14371443 assert_type (c_datetimeindex != ts , np_ndarray_bool ), np .ndarray , np .bool_
14381444 )
14391445 assert (eq_arr != ne_arr ).all ()
1446+ eq_arr = check (
1447+ assert_type (c_unknown_index == ts , np_ndarray_bool ), np .ndarray , np .bool_
1448+ )
1449+ ne_arr = check (
1450+ assert_type (c_unknown_index != ts , np_ndarray_bool ), np .ndarray , np .bool_
1451+ )
1452+ assert (eq_arr != ne_arr ).all ()
14401453
14411454 eq_a = check (assert_type (c_np_ndarray_dt64 != ts , Any ), np .ndarray , np .bool_ )
14421455 ne_a = check (assert_type (c_np_ndarray_dt64 == ts , Any ), np .ndarray , np .bool_ )
0 commit comments