| 
 | 1 | +import sys  | 
1 | 2 | from typing import List  | 
2 | 3 | 
 
  | 
3 | 4 | import pandas as pd  | 
@@ -288,14 +289,20 @@ def test_testing(self):  | 
288 | 289 |         self.check(testing, self.funcs)  | 
289 | 290 | 
 
  | 
290 | 291 |     def test_util_testing_deprecated(self):  | 
291 |  | -        s = pd.Series([], dtype="object")  | 
292 |  | -        with tm.assert_produces_warning(FutureWarning) as m:  | 
293 |  | -            import pandas.util.testing as tm2  | 
 | 292 | +        # avoid cache state affecting the test  | 
 | 293 | +        sys.modules.pop("pandas.util.testing", None)  | 
294 | 294 | 
 
  | 
295 |  | -            tm2.assert_series_equal(s, s)  | 
 | 295 | +        with tm.assert_produces_warning(FutureWarning) as m:  | 
 | 296 | +            import pandas.util.testing  # noqa: F401  | 
296 | 297 | 
 
  | 
297 |  | -        assert "pandas.testing.assert_series_equal" in str(m[0].message)  | 
 | 298 | +        assert "pandas.util.testing is deprecated" in str(m[0].message)  | 
 | 299 | +        assert "pandas.testing instead" in str(m[0].message)  | 
298 | 300 | 
 
  | 
 | 301 | +    def test_util_testing_deprecated_direct(self):  | 
 | 302 | +        # avoid cache state affecting the test  | 
 | 303 | +        sys.modules.pop("pandas.util.testing", None)  | 
299 | 304 |         with tm.assert_produces_warning(FutureWarning) as m:  | 
300 |  | -            tm2.DataFrame  | 
301 |  | -        assert "removed" in str(m[0].message)  | 
 | 305 | +            from pandas.util.testing import assert_series_equal  # noqa: F401  | 
 | 306 | + | 
 | 307 | +        assert "pandas.util.testing is deprecated" in str(m[0].message)  | 
 | 308 | +        assert "pandas.testing instead" in str(m[0].message)  | 
0 commit comments