Skip to content

Commit

Permalink
TST: Test searchsorted for monotonic decreasing index (#58692)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloqeely committed May 13, 2024
1 parent b195361 commit 31bb04a
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pandas/tests/indexes/test_common.py
Expand Up @@ -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

Expand All @@ -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"
Expand Down

0 comments on commit 31bb04a

Please sign in to comment.