From ad612c106cffacb2aa8497c88e2054b3a6b6768f Mon Sep 17 00:00:00 2001 From: Abdulaziz Aloqeely <52792999+Aloqeely@users.noreply.github.com> Date: Mon, 13 May 2024 05:13:07 +0300 Subject: [PATCH] TST: Test searchsorted for monotonic decreasing index --- pandas/tests/indexes/test_common.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/pandas/tests/indexes/test_common.py b/pandas/tests/indexes/test_common.py index b6e1c3698c258..43445433e2a04 100644 --- a/pandas/tests/indexes/test_common.py +++ b/pandas/tests/indexes/test_common.py @@ -270,9 +270,7 @@ def test_searchsorted_monotonic(self, index_flat, request): # all values are the same, expected_right should be length expected_right = len(index) - # test _searchsorted_monotonic in all cases - # test searchsorted only for increasing - if index.is_monotonic_increasing: + if index.is_monotonic_increasing or index.is_monotonic_decreasing: ssm_left = index._searchsorted_monotonic(value, side="left") assert expected_left == ssm_left @@ -284,13 +282,6 @@ def test_searchsorted_monotonic(self, index_flat, request): ss_right = index.searchsorted(value, side="right") assert expected_right == ss_right - - elif index.is_monotonic_decreasing: - ssm_left = index._searchsorted_monotonic(value, side="left") - assert expected_left == ssm_left - - ssm_right = index._searchsorted_monotonic(value, side="right") - assert expected_right == ssm_right else: # non-monotonic should raise. msg = "index must be monotonic increasing or decreasing"