Skip to content

Commit c368c32

Browse files
authored
DEPR: Remove pandas.util.testing (#49293)
1 parent 8715d63 commit c368c32

File tree

4 files changed

+1
-56
lines changed

4 files changed

+1
-56
lines changed

doc/source/whatsnew/v2.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Removal of prior version deprecations/changes
218218
- Removed the ``truediv`` keyword from :func:`eval` (:issue:`29812`)
219219
- Removed the ``pandas.datetime`` submodule (:issue:`30489`)
220220
- Removed the ``pandas.np`` submodule (:issue:`30296`)
221+
- Removed ``pandas.util.testing`` in favor of ``pandas.testing`` (:issue:`30745`)
221222
- Removed :meth:`Series.str.__iter__` (:issue:`28277`)
222223
- Removed ``pandas.SparseArray`` in favor of :class:`arrays.SparseArray` (:issue:`30642`)
223224
- Removed ``pandas.SparseSeries`` and ``pandas.SparseDataFrame`` (:issue:`30642`)

pandas/tests/api/test_api.py

-33
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
from __future__ import annotations
22

3-
import subprocess
4-
import sys
5-
63
import pytest
74

85
import pandas as pd
@@ -260,36 +257,6 @@ def test_testing(self):
260257

261258
self.check(testing, self.funcs)
262259

263-
def test_util_testing_deprecated(self):
264-
# avoid cache state affecting the test
265-
sys.modules.pop("pandas.util.testing", None)
266-
267-
with tm.assert_produces_warning(FutureWarning) as m:
268-
import pandas.util.testing # noqa: F401
269-
270-
assert "pandas.util.testing is deprecated" in str(m[0].message)
271-
assert "pandas.testing instead" in str(m[0].message)
272-
273-
def test_util_testing_deprecated_direct(self):
274-
# avoid cache state affecting the test
275-
sys.modules.pop("pandas.util.testing", None)
276-
with tm.assert_produces_warning(FutureWarning) as m:
277-
from pandas.util.testing import assert_series_equal # noqa: F401
278-
279-
assert "pandas.util.testing is deprecated" in str(m[0].message)
280-
assert "pandas.testing instead" in str(m[0].message)
281-
282260
def test_util_in_top_level(self):
283-
# in a subprocess to avoid import caching issues
284-
out = subprocess.check_output(
285-
[
286-
sys.executable,
287-
"-c",
288-
"import pandas; pandas.util.testing.assert_series_equal",
289-
],
290-
stderr=subprocess.STDOUT,
291-
).decode()
292-
assert "pandas.util.testing is deprecated" in out
293-
294261
with pytest.raises(AttributeError, match="foo"):
295262
pd.util.foo

pandas/util/__init__.py

-9
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,3 @@
99
hash_array,
1010
hash_pandas_object,
1111
)
12-
13-
14-
def __getattr__(name):
15-
if name == "testing":
16-
import pandas.util.testing
17-
18-
return pandas.util.testing
19-
else:
20-
raise AttributeError(f"module 'pandas.util' has no attribute '{name}'")

pandas/util/testing.py

-14
This file was deleted.

0 commit comments

Comments
 (0)