Skip to content

Commit 09c7f5d

Browse files
committed
pre-commit run --all-files changes
1 parent 0ccca08 commit 09c7f5d

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

pandas/tests/indexes/test_common.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ def test_hasnans_isnans(self, index_flat):
445445
def test_sort_values_invalid_na_position(index_with_missing, na_position):
446446
non_na_values = [x for x in index_with_missing if pd.notna(x)]
447447
if len({type(x) for x in non_na_values}) > 1:
448-
pytest.xfail("Sorting fails due to heterogeneous types in index"
449-
" (int vs str)")
448+
pytest.mark.xfail(reason="Sorting fails due to heterogeneous types in index (int vs str)")
450449

451450
with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"):
452451
index_with_missing.sort_values(na_position=na_position)
@@ -463,8 +462,7 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
463462

464463
non_na_values = [x for x in index_with_missing if pd.notna(x)]
465464
if len({type(x) for x in non_na_values}) > 1:
466-
pytest.xfail("Sorting fails due to heterogeneous types"
467-
" in index (int vs str)")
465+
pytest.mark.xfail(reason="Sorting fails due to heterogeneous types in index (int vs str)")
468466

469467
if isinstance(index_with_missing, CategoricalIndex):
470468
request.applymarker(

pandas/tests/indexes/test_numpy_compat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ def test_numpy_ufuncs_reductions(index, func, request):
159159
has_int = any(isinstance(x, int) for x in index)
160160
if has_str and has_int:
161161
request.applymarker(
162-
pytest.mark.xfail(reason="Cannot compare mixed types (int and str)"
163-
" in ufunc reductions")
162+
pytest.mark.xfail(
163+
reason="Cannot compare mixed types (int and str) in ufunc reductions"
164+
)
164165
)
165166
if isinstance(index, CategoricalIndex) and index.dtype.ordered is False:
166167
with pytest.raises(TypeError, match="is not ordered for"):

pandas/tests/indexes/test_old_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def test_argsort(self, index):
359359
pytest.skip(f"{type(self).__name__} separately tested")
360360

361361
# New test for mixed-int-string
362-
if index.equals(pd.Index([0, "a", 1, "b", 2, "c"])):
362+
if index.equals(Index([0, "a", 1, "b", 2, "c"])):
363363
result = index.astype(str).argsort()
364364
expected = np.array(index.astype(str)).argsort()
365365
tm.assert_numpy_array_equal(result, expected, check_dtype=False)

pandas/tests/indexes/test_setops.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def index_flat2(index_flat):
6565

6666
def test_union_same_types(index):
6767
# mixed int string
68-
if index.equals(pd.Index([0, "a", 1, "b", 2, "c"])):
68+
if index.equals(Index([0, "a", 1, "b", 2, "c"])):
6969
index = index.astype(str)
7070

7171
idx1 = index.sort_values()
@@ -920,16 +920,16 @@ def test_symmetric_difference_mi(self, sort):
920920
index2 = MultiIndex.from_tuples([("foo", 1), ("bar", 3)])
921921

922922
def has_mixed_types(level):
923-
return (
924-
any(isinstance(x, str) for x in level)
925-
and any(isinstance(x, int) for x in level)
923+
return any(isinstance(x, str) for x in level) and any(
924+
isinstance(x, int) for x in level
926925
)
927926

928927
for idx in [index1, index2]:
929928
for lvl in range(idx.nlevels):
930929
if has_mixed_types(idx.get_level_values(lvl)):
931-
pytest.skip(f"Mixed types in MultiIndex level {lvl}"
932-
" are not orderable")
930+
pytest.skip(
931+
f"Mixed types in MultiIndex level {lvl} are not orderable"
932+
)
933933

934934
result = index1.symmetric_difference(index2, sort=sort)
935935
expected = MultiIndex.from_tuples([("bar", 2), ("baz", 3), ("bar", 3)])

pandas/tests/test_algos.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ def test_factorize_complex(self):
6363
expected_uniques = np.array([(1 + 0j), (2 + 0j), (2 + 1j)], dtype=complex)
6464
tm.assert_numpy_array_equal(uniques, expected_uniques)
6565

66-
@pytest.mark.parametrize("index_or_series_obj",
67-
[
68-
[1, 2, 3],
69-
["a", "b", "c"],
70-
[0, "a", 1, "b", 2, "c"]
71-
])
66+
@pytest.mark.parametrize(
67+
"index_or_series_obj", [[1, 2, 3], ["a", "b", "c"], [0, "a", 1, "b", 2, "c"]]
68+
)
7269
@pytest.mark.parametrize("sort", [True, False])
7370
def test_factorize(self, index_or_series_obj, sort):
7471
obj = Index(index_or_series_obj)
@@ -77,9 +74,10 @@ def test_factorize(self, index_or_series_obj, sort):
7774
pytest.skip("Skipping test for empty Index")
7875

7976
if obj.name == "mixed-int-string" or obj.name is None:
80-
pytest.skip("Skipping test for mixed-int-string due"
81-
" to unsupported comparison between str and int")
82-
77+
pytest.skip(
78+
"Skipping test for mixed-int-string due "
79+
"to unsupported comparison between str and int"
80+
)
8381

8482
result_codes, result_uniques = obj.factorize(sort=sort)
8583

0 commit comments

Comments
 (0)