|
2 | 2 |
|
3 | 3 | import datetime |
4 | 4 | import datetime as dt |
| 5 | +import sys |
5 | 6 | from typing import ( |
6 | 7 | TYPE_CHECKING, |
7 | 8 | Any, |
|
51 | 52 | PeriodSeries: TypeAlias = pd.Series |
52 | 53 | OffsetSeries: TypeAlias = pd.Series |
53 | 54 |
|
| 55 | +MYPY = False |
| 56 | + |
54 | 57 |
|
55 | 58 | def test_interval() -> None: |
56 | 59 | interval_i = pd.Interval(0, 1, closed="left") |
@@ -1387,21 +1390,22 @@ def test_timestamp_cmp() -> None: |
1387 | 1390 | ) |
1388 | 1391 | assert (eq_arr != ne_arr).all() |
1389 | 1392 |
|
1390 | | - eq_arr = check( |
1391 | | - assert_type(ts == c_np_ndarray_dt64, np_ndarray_bool), np.ndarray, np.bool_ |
1392 | | - ) |
1393 | | - ne_arr = check( |
1394 | | - assert_type(ts != c_np_ndarray_dt64, np_ndarray_bool), np.ndarray, np.bool_ |
1395 | | - ) |
1396 | | - assert (eq_arr != ne_arr).all() |
1397 | | - # TODO: the following should be 2D-arrays but it doesn't work in mypy |
1398 | | - eq_arr = check( |
1399 | | - assert_type(ts == c_np_2darray_dt64, np_ndarray_bool), np_ndarray_bool |
1400 | | - ) |
1401 | | - ne_arr = check( |
1402 | | - assert_type(ts != c_np_2darray_dt64, np_ndarray_bool), np_ndarray_bool |
1403 | | - ) |
1404 | | - assert (eq_arr != ne_arr).all() |
| 1393 | + if sys.version_info >= (3, 11) or not MYPY: |
| 1394 | + eq_arr = check( |
| 1395 | + assert_type(ts == c_np_ndarray_dt64, np_ndarray_bool), np.ndarray, np.bool_ |
| 1396 | + ) |
| 1397 | + ne_arr = check( |
| 1398 | + assert_type(ts != c_np_ndarray_dt64, np_ndarray_bool), np.ndarray, np.bool_ |
| 1399 | + ) |
| 1400 | + assert (eq_arr != ne_arr).all() |
| 1401 | + # TODO: the following should be 2D-arrays but it doesn't work in mypy |
| 1402 | + eq_arr = check( |
| 1403 | + assert_type(ts == c_np_2darray_dt64, np_ndarray_bool), np_ndarray_bool |
| 1404 | + ) |
| 1405 | + ne_arr = check( |
| 1406 | + assert_type(ts != c_np_2darray_dt64, np_ndarray_bool), np_ndarray_bool |
| 1407 | + ) |
| 1408 | + assert (eq_arr != ne_arr).all() |
1405 | 1409 |
|
1406 | 1410 | eq_s = check( |
1407 | 1411 | assert_type(ts == c_series_timestamp, "pd.Series[bool]"), pd.Series, np.bool_ |
|
0 commit comments