- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 152
Open
Labels
Testingpandas testing functions or related to the test suitepandas testing functions or related to the test suitegood first issue
Description
After #1456, there is an issue that can be improved in the tests.
The following two parts are duplicated, because data, idx and dt_idx are all DatetimeIndexes. The second part can be removed. Also see the link in TODO.
pandas-stubs/tests/indexes/test_datetime_index.py
Lines 26 to 48 in 84f8d36
| idx = check( | |
| assert_type(pd.Index(data, name="date"), pd.DatetimeIndex), pd.DatetimeIndex | |
| ) | |
| check(assert_type(data[x <= idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[x < idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[x >= idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[x > idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[idx <= x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[idx < x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[idx >= x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[idx > x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| # TODO: https://github.com/pandas-dev/pandas-stubs/pull/1438#discussion_r2451864012 | |
| # Can this be de-duplicated? | |
| dt_idx = pd.DatetimeIndex(data, name="date") | |
| check(assert_type(data[x <= dt_idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[x < dt_idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[x >= dt_idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[x > dt_idx], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[dt_idx <= x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[dt_idx < x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[dt_idx >= x], pd.DatetimeIndex), pd.DatetimeIndex) | |
| check(assert_type(data[dt_idx > x], pd.DatetimeIndex), pd.DatetimeIndex) | 
Metadata
Metadata
Assignees
Labels
Testingpandas testing functions or related to the test suitepandas testing functions or related to the test suitegood first issue