Skip to content

Commit 2c615b0

Browse files
committed
move tests
1 parent 1e527da commit 2c615b0

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

pandas/tests/frame/test_block_internals.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from pandas import (DataFrame, Series, Timestamp, date_range, compat,
1414
option_context, Categorical)
15+
from pandas.core.internals.blocks import IntBlock
1516
from pandas.core.arrays import IntervalArray, integer_array
1617
from pandas.compat import StringIO
1718
import pandas as pd
@@ -579,3 +580,12 @@ def test_strange_column_corruption_issue(self):
579580
first = len(df.loc[pd.isna(df[myid]), [myid]])
580581
second = len(df.loc[pd.isna(df[myid]), [myid]])
581582
assert first == second == 0
583+
584+
def test_constructor_no_pandas_array(self):
585+
# Ensure that PandasArray isn't allowed inside Series
586+
# See https://github.com/pandas-dev/pandas/issues/23995 for more.
587+
arr = pd.Series([1, 2, 3]).array
588+
result = pd.DataFrame({"A": arr})
589+
expected = pd.DataFrame({"A": [1, 2, 3]})
590+
tm.assert_frame_equal(result, expected)
591+
assert isinstance(result._data.blocks[0], IntBlock)

pandas/tests/frame/test_constructors.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import pandas as pd
2424
import pandas.util.testing as tm
2525
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
26-
from pandas.core.internals.blocks import IntBlock
2726

2827
from pandas.tests.frame.common import TestData
2928

@@ -2166,15 +2165,6 @@ def test_constructor_range_dtype(self, dtype):
21662165
result = DataFrame({'A': range(5)}, dtype=dtype)
21672166
tm.assert_frame_equal(result, expected)
21682167

2169-
def test_constructor_no_numpy_backed_ea(self):
2170-
# Ensure that PandasArray isn't allowed inside Series
2171-
# See https://github.com/pandas-dev/pandas/issues/23995 for more.
2172-
arr = pd.Series([1, 2, 3]).array
2173-
result = pd.DataFrame({"A": arr})
2174-
expected = pd.DataFrame({"A": [1, 2, 3]})
2175-
tm.assert_frame_equal(result, expected)
2176-
assert isinstance(result._data.blocks[0], IntBlock)
2177-
21782168
def test_frame_from_list_subclass(self):
21792169
# GH21226
21802170
class List(list):

pandas/tests/indexes/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_constructor_int_dtype_nan_raises(self, dtype):
258258
with pytest.raises(ValueError, match=msg):
259259
Index(data, dtype=dtype)
260260

261-
def test_constructor_no_numpy_backed_ea(self):
261+
def test_constructor_no_pandas_array(self):
262262
ser = pd.Series([1, 2, 3])
263263
result = pd.Index(ser.array)
264264
expected = pd.Index([1, 2, 3])

pandas/tests/series/test_constructors.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
Timestamp, date_range, isna, period_range, timedelta_range)
2323
from pandas.api.types import CategoricalDtype
2424
from pandas.core.arrays import period_array
25-
from pandas.core.internals.blocks import IntBlock
2625
import pandas.util.testing as tm
2726
from pandas.util.testing import assert_series_equal
2827

@@ -1239,9 +1238,3 @@ def test_constructor_tz_mixed_data(self):
12391238
result = Series(dt_list)
12401239
expected = Series(dt_list, dtype=object)
12411240
tm.assert_series_equal(result, expected)
1242-
1243-
def test_constructor_no_numpy_backed_ea(self):
1244-
ser = pd.Series([1, 2, 3])
1245-
result = pd.Series(ser.array)
1246-
tm.assert_series_equal(ser, result)
1247-
assert isinstance(result._data.blocks[0], IntBlock)

pandas/tests/series/test_internals.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import pandas as pd
1010
from pandas import NaT, Series, Timestamp
11+
from pandas.core.internals.blocks import IntBlock
1112
import pandas.util.testing as tm
1213
from pandas.util.testing import assert_series_equal
1314

@@ -306,6 +307,12 @@ def test_convert_preserve_all_bool(self):
306307
e = Series([False, True, False, False], dtype=bool)
307308
tm.assert_series_equal(r, e)
308309

310+
def test_constructor_no_pandas_array(self):
311+
ser = pd.Series([1, 2, 3])
312+
result = pd.Series(ser.array)
313+
tm.assert_series_equal(ser, result)
314+
assert isinstance(result._data.blocks[0], IntBlock)
315+
309316

310317
def test_hasnans_unchached_for_series():
311318
# GH#19700

0 commit comments

Comments
 (0)