Skip to content

DEPR: Remove pandas.util.testing #49293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Removal of prior version deprecations/changes
- Removed the ``truediv`` keyword from :func:`eval` (:issue:`29812`)
- Removed the ``pandas.datetime`` submodule (:issue:`30489`)
- Removed the ``pandas.np`` submodule (:issue:`30296`)
- Removed ``pandas.util.testing`` in favor of ``pandas.testing`` (:issue:`30745`)
- Removed :meth:`Series.str.__iter__` (:issue:`28277`)
- Removed ``pandas.SparseArray`` in favor of :class:`arrays.SparseArray` (:issue:`30642`)
- Removed ``pandas.SparseSeries`` and ``pandas.SparseDataFrame`` (:issue:`30642`)
Expand Down
33 changes: 0 additions & 33 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from __future__ import annotations

import subprocess
import sys

import pytest

import pandas as pd
Expand Down Expand Up @@ -260,36 +257,6 @@ def test_testing(self):

self.check(testing, self.funcs)

def test_util_testing_deprecated(self):
# avoid cache state affecting the test
sys.modules.pop("pandas.util.testing", None)

with tm.assert_produces_warning(FutureWarning) as m:
import pandas.util.testing # noqa: F401

assert "pandas.util.testing is deprecated" in str(m[0].message)
assert "pandas.testing instead" in str(m[0].message)

def test_util_testing_deprecated_direct(self):
# avoid cache state affecting the test
sys.modules.pop("pandas.util.testing", None)
with tm.assert_produces_warning(FutureWarning) as m:
from pandas.util.testing import assert_series_equal # noqa: F401

assert "pandas.util.testing is deprecated" in str(m[0].message)
assert "pandas.testing instead" in str(m[0].message)

def test_util_in_top_level(self):
# in a subprocess to avoid import caching issues
out = subprocess.check_output(
[
sys.executable,
"-c",
"import pandas; pandas.util.testing.assert_series_equal",
],
stderr=subprocess.STDOUT,
).decode()
assert "pandas.util.testing is deprecated" in out

with pytest.raises(AttributeError, match="foo"):
pd.util.foo
9 changes: 0 additions & 9 deletions pandas/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,3 @@
hash_array,
hash_pandas_object,
)


def __getattr__(name):
if name == "testing":
import pandas.util.testing

return pandas.util.testing
else:
raise AttributeError(f"module 'pandas.util' has no attribute '{name}'")
14 changes: 0 additions & 14 deletions pandas/util/testing.py

This file was deleted.