forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: misplaced array tests (pandas-dev#46136)
* REF: directory for PandasArray tests * REF: misplaced tests
- Loading branch information
1 parent
e7d6846
commit 2fe0c70
Showing
5 changed files
with
46 additions
and
59 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import numpy as np | ||
|
||
from pandas.core.dtypes.common import is_scalar | ||
|
||
import pandas as pd | ||
import pandas._testing as tm | ||
|
||
|
||
class TestSearchsorted: | ||
def test_searchsorted_numeric_dtypes_scalar(self, any_real_numpy_dtype): | ||
arr = pd.array([1, 3, 90], dtype=any_real_numpy_dtype) | ||
result = arr.searchsorted(30) | ||
assert is_scalar(result) | ||
assert result == 2 | ||
|
||
result = arr.searchsorted([30]) | ||
expected = np.array([2], dtype=np.intp) | ||
tm.assert_numpy_array_equal(result, expected) | ||
|
||
def test_searchsorted_numeric_dtypes_vector(self, any_real_numpy_dtype): | ||
arr = pd.array([1, 3, 90], dtype=any_real_numpy_dtype) | ||
result = arr.searchsorted([2, 30]) | ||
expected = np.array([1, 2], dtype=np.intp) | ||
tm.assert_numpy_array_equal(result, expected) | ||
|
||
def test_searchsorted_sorter(self, any_real_numpy_dtype): | ||
arr = pd.array([3, 1, 2], dtype=any_real_numpy_dtype) | ||
result = arr.searchsorted([0, 3], sorter=np.argsort(arr)) | ||
expected = np.array([0, 2], dtype=np.intp) | ||
tm.assert_numpy_array_equal(result, expected) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from pandas.core.dtypes.common import is_scalar | ||
|
||
import pandas as pd | ||
|
||
|
||
class TestSearchsorted: | ||
def test_searchsorted(self, string_dtype): | ||
arr = pd.array(["a", "b", "c"], dtype=string_dtype) | ||
|
||
result = arr.searchsorted("a", side="left") | ||
assert is_scalar(result) | ||
assert result == 0 | ||
|
||
result = arr.searchsorted("a", side="right") | ||
assert is_scalar(result) | ||
assert result == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters