Skip to content

Commit

Permalink
TST: Remove arraymanager markers (#56626)
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Dec 27, 2023
1 parent 12d69c8 commit 3c15cfd
Show file tree
Hide file tree
Showing 35 changed files with 2 additions and 134 deletions.
2 changes: 0 additions & 2 deletions pandas/tests/copy_view/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest

from pandas.compat.pyarrow import pa_version_under12p0
import pandas.util._test_decorators as td

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -88,7 +87,6 @@ def test_astype_different_target_dtype(using_copy_on_write, dtype):
tm.assert_frame_equal(df2, df_orig.astype(dtype))


@td.skip_array_manager_invalid_test
def test_astype_numpy_to_ea():
ser = Series([1, 2, 3])
with pd.option_context("mode.copy_on_write", True):
Expand Down
5 changes: 0 additions & 5 deletions pandas/tests/copy_view/test_internals.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array


@td.skip_array_manager_invalid_test
def test_consolidate(using_copy_on_write):
# create unconsolidated DataFrame
df = DataFrame({"a": [1, 2, 3], "b": [0.1, 0.2, 0.3]})
Expand Down Expand Up @@ -46,7 +43,6 @@ def test_consolidate(using_copy_on_write):


@pytest.mark.single_cpu
@td.skip_array_manager_invalid_test
def test_switch_options():
# ensure we can switch the value of the option within one session
# (assuming data is constructed after switching)
Expand Down Expand Up @@ -75,7 +71,6 @@ def test_switch_options():
assert df.iloc[0, 0] == 0


@td.skip_array_manager_invalid_test
@pytest.mark.parametrize("dtype", [np.intp, np.int8])
@pytest.mark.parametrize(
"locs, arr",
Expand Down
5 changes: 0 additions & 5 deletions pandas/tests/frame/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
PerformanceWarning,
SettingWithCopyError,
)
import pandas.util._test_decorators as td

from pandas.core.dtypes.common import is_integer

Expand Down Expand Up @@ -574,7 +573,6 @@ def test_getitem_setitem_integer_slice_keyerrors(self):
with pytest.raises(KeyError, match=r"^3$"):
df2.loc[3:11] = 0

@td.skip_array_manager_invalid_test # already covered in test_iloc_col_slice_view
def test_fancy_getitem_slice_mixed(
self, float_frame, float_string_frame, using_copy_on_write, warn_copy_on_write
):
Expand Down Expand Up @@ -640,7 +638,6 @@ def test_getitem_fancy_scalar(self, float_frame):
for idx in f.index[::5]:
assert ix[idx, col] == ts[idx]

@td.skip_array_manager_invalid_test # TODO(ArrayManager) rewrite not using .values
def test_setitem_fancy_scalar(self, float_frame):
f = float_frame
expected = float_frame.copy()
Expand Down Expand Up @@ -680,7 +677,6 @@ def test_getitem_fancy_boolean(self, float_frame):
expected = f.reindex(index=f.index[boolvec], columns=["C", "D"])
tm.assert_frame_equal(result, expected)

@td.skip_array_manager_invalid_test # TODO(ArrayManager) rewrite not using .values
def test_setitem_fancy_boolean(self, float_frame):
# from 2d, set with booleans
frame = float_frame.copy()
Expand Down Expand Up @@ -1404,7 +1400,6 @@ def test_loc_setitem_rhs_frame(self, idxr, val, warn):
expected = DataFrame({"a": [np.nan, val]})
tm.assert_frame_equal(df, expected)

@td.skip_array_manager_invalid_test
def test_iloc_setitem_enlarge_no_warning(self, warn_copy_on_write):
# GH#47381
df = DataFrame(columns=["a", "b"])
Expand Down
6 changes: 0 additions & 6 deletions pandas/tests/frame/indexing/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas.core.dtypes.base import _registry as ea_registry
from pandas.core.dtypes.common import is_object_dtype
from pandas.core.dtypes.dtypes import (
Expand Down Expand Up @@ -704,8 +702,6 @@ def test_setitem_ea_dtype_rhs_series(self):
expected = DataFrame({"a": [1, 2]}, dtype="Int64")
tm.assert_frame_equal(df, expected)

# TODO(ArrayManager) set column with 2d column array, see #44788
@td.skip_array_manager_not_yet_implemented
def test_setitem_npmatrix_2d(self):
# GH#42376
# for use-case df["x"] = sparse.random((10, 10)).mean(axis=1)
Expand Down Expand Up @@ -1063,7 +1059,6 @@ def inc(x):


class TestDataFrameSetItemBooleanMask:
@td.skip_array_manager_invalid_test # TODO(ArrayManager) rewrite not using .values
@pytest.mark.parametrize(
"mask_type",
[lambda df: df > np.abs(df) / 2, lambda df: (df > np.abs(df) / 2).values],
Expand Down Expand Up @@ -1307,7 +1302,6 @@ def test_setitem_not_operating_inplace(self, value, set_value, indexer):
df[indexer] = set_value
tm.assert_frame_equal(view, expected)

@td.skip_array_manager_invalid_test
def test_setitem_column_update_inplace(
self, using_copy_on_write, warn_copy_on_write
):
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/frame/methods/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_copy(self, float_frame, float_string_frame):
copy = float_string_frame.copy()
assert copy._mgr is not float_string_frame._mgr

@td.skip_array_manager_invalid_test
def test_copy_consolidates(self):
# GH#42477
df = DataFrame(
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/frame/methods/test_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from pandas._config import using_pyarrow_string_dtype

import pandas.util._test_decorators as td

from pandas import (
Categorical,
DataFrame,
Expand Down Expand Up @@ -49,7 +47,6 @@ def test_fillna_dict_inplace_nonunique_columns(
if not using_copy_on_write:
assert tm.shares_memory(df.iloc[:, 2], orig.iloc[:, 2])

@td.skip_array_manager_not_yet_implemented
def test_fillna_on_column_view(self, using_copy_on_write):
# GH#46149 avoid unnecessary copies
arr = np.full((40, 50), np.nan)
Expand Down Expand Up @@ -752,7 +749,6 @@ def test_fillna_inplace_with_columns_limit_and_value(self):
df.fillna(axis=1, value=100, limit=1, inplace=True)
tm.assert_frame_equal(df, expected)

@td.skip_array_manager_invalid_test
@pytest.mark.parametrize("val", [-1, {"x": -1, "y": -1}])
def test_inplace_dict_update_view(
self, val, using_copy_on_write, warn_copy_on_write
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def test_interp_string_axis(self, axis_name, axis_number):

@pytest.mark.parametrize("multiblock", [True, False])
@pytest.mark.parametrize("method", ["ffill", "bfill", "pad"])
def test_interp_fillna_methods(self, request, axis, multiblock, method):
def test_interp_fillna_methods(self, axis, multiblock, method):
# GH 12918
df = DataFrame(
{
Expand Down
5 changes: 0 additions & 5 deletions pandas/tests/frame/methods/test_is_homogeneous_dtype.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
Categorical,
DataFrame,
)

# _is_homogeneous_type always returns True for ArrayManager
pytestmark = td.skip_array_manager_invalid_test


@pytest.mark.parametrize(
"data, expected",
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/methods/test_reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
is_platform_windows,
)
from pandas.compat.numpy import np_version_gt2
import pandas.util._test_decorators as td

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -136,7 +135,6 @@ class TestDataFrameSelectReindex:
reason="Passes int32 values to DatetimeArray in make_na_array on "
"windows, 32bit linux builds",
)
@td.skip_array_manager_not_yet_implemented
def test_reindex_tzaware_fill_value(self):
# GH#52586
df = DataFrame([[1]])
Expand Down Expand Up @@ -198,7 +196,6 @@ def test_reindex_copies_ea(self, using_copy_on_write):
else:
assert not np.shares_memory(result2[0].array._data, df[0].array._data)

@td.skip_array_manager_not_yet_implemented
def test_reindex_date_fill_value(self):
# passing date to dt64 is deprecated; enforced in 2.0 to cast to object
arr = date_range("2016-01-01", periods=6).values.reshape(3, 2)
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/methods/test_shift.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

import pandas as pd
from pandas import (
CategoricalIndex,
Expand Down Expand Up @@ -464,7 +462,6 @@ def test_shift_axis1_multiple_blocks(self):

tm.assert_frame_equal(result, expected)

@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) axis=1 support
def test_shift_axis1_multiple_blocks_with_int_fill(self):
# GH#42719
rng = np.random.default_rng(2)
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/frame/methods/test_to_dict_of_blocks.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
DataFrame,
MultiIndex,
)
import pandas._testing as tm
from pandas.core.arrays import NumpyExtensionArray

pytestmark = td.skip_array_manager_invalid_test


class TestToDictOfBlocks:
@pytest.mark.filterwarnings("ignore:Setting a value on a view:FutureWarning")
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/methods/test_to_numpy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import numpy as np

import pandas.util._test_decorators as td

from pandas import (
DataFrame,
Timestamp,
Expand All @@ -22,7 +20,6 @@ def test_to_numpy_dtype(self):
result = df.to_numpy(dtype="int64")
tm.assert_numpy_array_equal(result, expected)

@td.skip_array_manager_invalid_test
def test_to_numpy_copy(self, using_copy_on_write):
arr = np.random.default_rng(2).standard_normal((4, 3))
df = DataFrame(arr)
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/frame/methods/test_transpose.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
DataFrame,
DatetimeIndex,
Expand Down Expand Up @@ -126,7 +124,6 @@ def test_transpose_mixed(self):
for col, s in mixed_T.items():
assert s.dtype == np.object_

@td.skip_array_manager_invalid_test
def test_transpose_get_view(self, float_frame, using_copy_on_write):
dft = float_frame.T
dft.iloc[:, 5:10] = 5
Expand All @@ -136,7 +133,6 @@ def test_transpose_get_view(self, float_frame, using_copy_on_write):
else:
assert (float_frame.values[5:10] == 5).all()

@td.skip_array_manager_invalid_test
def test_transpose_get_view_dt64tzget_view(self, using_copy_on_write):
dti = date_range("2016-01-01", periods=6, tz="US/Pacific")
arr = dti._data.reshape(3, 2)
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/methods/test_update.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

import pandas as pd
from pandas import (
DataFrame,
Expand Down Expand Up @@ -175,7 +173,6 @@ def test_update_with_different_dtype(self, using_copy_on_write):
)
tm.assert_frame_equal(df, expected)

@td.skip_array_manager_invalid_test
def test_update_modify_view(
self, using_copy_on_write, warn_copy_on_write, using_infer_string
):
Expand Down
5 changes: 0 additions & 5 deletions pandas/tests/frame/methods/test_values.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
DataFrame,
NaT,
Expand All @@ -15,7 +13,6 @@


class TestDataFrameValues:
@td.skip_array_manager_invalid_test
def test_values(self, float_frame, using_copy_on_write):
if using_copy_on_write:
with pytest.raises(ValueError, match="read-only"):
Expand Down Expand Up @@ -231,7 +228,6 @@ def test_values_lcd(self, mixed_float_frame, mixed_int_frame):


class TestPrivateValues:
@td.skip_array_manager_invalid_test
def test_private_values_dt64tz(self, using_copy_on_write):
dta = date_range("2000", periods=4, tz="US/Central")._data.reshape(-1, 1)

Expand All @@ -249,7 +245,6 @@ def test_private_values_dt64tz(self, using_copy_on_write):
df2 = df - df
tm.assert_equal(df2._values, tda)

@td.skip_array_manager_invalid_test
def test_private_values_dt64tz_multicol(self, using_copy_on_write):
dta = date_range("2000", periods=8, tz="US/Central")._data.reshape(-1, 2)

Expand Down
2 changes: 0 additions & 2 deletions pandas/tests/frame/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,6 @@ def test_df_arith_2d_array_rowlike_broadcasts(
):
# GH#23000
opname = all_arithmetic_operators

arr = np.arange(6).reshape(3, 2)
df = DataFrame(arr, columns=[True, False], index=["A", "B", "C"])

Expand All @@ -919,7 +918,6 @@ def test_df_arith_2d_array_collike_broadcasts(
):
# GH#23000
opname = all_arithmetic_operators

arr = np.arange(6).reshape(3, 2)
df = DataFrame(arr, columns=[True, False], index=["A", "B", "C"])

Expand Down
6 changes: 0 additions & 6 deletions pandas/tests/frame/test_block_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import pytest

from pandas.errors import PerformanceWarning
import pandas.util._test_decorators as td

import pandas as pd
from pandas import (
Expand All @@ -26,11 +25,6 @@
# structure


# TODO(ArrayManager) check which of those tests need to be rewritten to test the
# equivalent for ArrayManager
pytestmark = td.skip_array_manager_invalid_test


class TestDataFrameBlockInternals:
def test_setitem_invalidates_datetime_index_freq(self):
# GH#24096 altering a datetime64tz column inplace invalidates the
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from pandas._libs import lib
from pandas.errors import IntCastingNaNError
import pandas.util._test_decorators as td

from pandas.core.dtypes.common import is_integer_dtype
from pandas.core.dtypes.dtypes import (
Expand Down Expand Up @@ -324,15 +323,13 @@ def test_constructor_dtype_nocast_view_2d_array(
df2 = DataFrame(df.values, dtype=df[0].dtype)
assert df2._mgr.arrays[0].flags.c_contiguous

@td.skip_array_manager_invalid_test
@pytest.mark.xfail(using_pyarrow_string_dtype(), reason="conversion copies")
def test_1d_object_array_does_not_copy(self):
# https://github.com/pandas-dev/pandas/issues/39272
arr = np.array(["a", "b"], dtype="object")
df = DataFrame(arr, copy=False)
assert np.shares_memory(df.values, arr)

@td.skip_array_manager_invalid_test
@pytest.mark.xfail(using_pyarrow_string_dtype(), reason="conversion copies")
def test_2d_object_array_does_not_copy(self):
# https://github.com/pandas-dev/pandas/issues/39272
Expand Down Expand Up @@ -2489,7 +2486,6 @@ def test_constructor_list_str_na(self, string_dtype):
@pytest.mark.parametrize("copy", [False, True])
def test_dict_nocopy(
self,
request,
copy,
any_numeric_ea_dtype,
any_numpy_dtype,
Expand Down

0 comments on commit 3c15cfd

Please sign in to comment.