|
19 | 19 |
|
20 | 20 | from pandas.errors import PerformanceWarning
|
21 | 21 |
|
22 |
| -from pandas.core.dtypes.common import is_object_dtype |
23 |
| - |
24 | 22 | import pandas as pd
|
25 | 23 | from pandas import SparseDtype
|
26 | 24 | import pandas._testing as tm
|
@@ -382,27 +380,6 @@ def test_equals(self, data, na_value, as_series, box):
|
382 | 380 |
|
383 | 381 |
|
384 | 382 | class TestCasting(BaseSparseTests, base.BaseCastingTests):
|
385 |
| - def _test_astype_object_series(self, all_data): |
386 |
| - # Unlike the base class, we do not expect the resulting Block |
387 |
| - # to be ObjectBlock / resulting array to be np.dtype("object") |
388 |
| - ser = pd.Series(all_data, name="A") |
389 |
| - with tm.assert_produces_warning(FutureWarning, match="astype from Sparse"): |
390 |
| - result = ser.astype(object) |
391 |
| - assert is_object_dtype(result.dtype) |
392 |
| - assert is_object_dtype(result._mgr.array.dtype) |
393 |
| - |
394 |
| - def _test_astype_object_frame(self, all_data): |
395 |
| - # Unlike the base class, we do not expect the resulting Block |
396 |
| - # to be ObjectBlock / resulting array to be np.dtype("object") |
397 |
| - df = pd.DataFrame({"A": all_data}) |
398 |
| - |
399 |
| - result = df.astype(object) |
400 |
| - assert is_object_dtype(result._mgr.arrays[0].dtype) |
401 |
| - |
402 |
| - # check that we can compare the dtypes |
403 |
| - comp = result.dtypes == df.dtypes |
404 |
| - assert not comp.any() |
405 |
| - |
406 | 383 | def test_astype_str(self, data):
|
407 | 384 | # pre-2.0 this would give a SparseDtype even if the user asked
|
408 | 385 | # for a non-sparse dtype.
|
|
0 commit comments