Skip to content

Commit cd1d38b

Browse files
changed test location to block_internals
1 parent 8a4c87f commit cd1d38b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pandas/tests/frame/test_block_internals.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Categorical, DataFrame, Series, Timestamp, compat, date_range,
1111
option_context)
1212
from pandas.core.arrays import IntervalArray, integer_array
13+
from pandas.core.internals import ObjectBlock
1314
from pandas.core.internals.blocks import IntBlock
1415
import pandas.util.testing as tm
1516
from pandas.util.testing import (
@@ -584,3 +585,13 @@ def test_constructor_no_pandas_array(self):
584585
expected = pd.DataFrame({"A": [1, 2, 3]})
585586
tm.assert_frame_equal(result, expected)
586587
assert isinstance(result._data.blocks[0], IntBlock)
588+
589+
def test_add_column_with_pandas_array(self):
590+
# GH 26390
591+
df = pd.DataFrame({'a': [1, 2, 3, 4], 'b': ['a', 'b', 'c', 'd']})
592+
df['c'] = pd.array([1, 2, None, 3])
593+
df2 = pd.DataFrame({'a': [1, 2, 3, 4], 'b': ['a', 'b', 'c', 'd'],
594+
'c': pd.array([1, 2, None, 3])})
595+
assert type(df['c']._data.blocks[0]) == ObjectBlock
596+
assert type(df2['c']._data.blocks[0]) == ObjectBlock
597+
assert_frame_equal(df, df2)

pandas/tests/internals/test_internals.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import pandas.core.algorithms as algos
1919
from pandas.core.arrays import DatetimeArray, TimedeltaArray
2020
from pandas.core.internals import (
21-
BlockManager, ObjectBlock, SingleBlockManager, make_block)
21+
BlockManager, SingleBlockManager, make_block)
2222
import pandas.util.testing as tm
2323
from pandas.util.testing import (
2424
assert_almost_equal, assert_frame_equal, assert_series_equal, randn)
@@ -1311,14 +1311,3 @@ def test_make_block_no_pandas_array():
13111311
result = make_block(arr.to_numpy(), slice(len(arr)), dtype=arr.dtype)
13121312
assert result.is_integer is True
13131313
assert result.is_extension is False
1314-
1315-
1316-
def test_add_column_with_pandas_array():
1317-
# GH 26390
1318-
df = pd.DataFrame({'a': [1, 2, 3, 4], 'b': ['a', 'b', 'c', 'd']})
1319-
df['c'] = pd.array([1, 2, None, 3])
1320-
df2 = pd.DataFrame({'a': [1, 2, 3, 4], 'b': ['a', 'b', 'c', 'd'],
1321-
'c': pd.array([1, 2, None, 3])})
1322-
assert(df2['c']._data.blocks[0].__class__ == ObjectBlock)
1323-
assert(df['c']._data.blocks[0].__class__ == ObjectBlock)
1324-
assert_frame_equal(df, df2)

0 commit comments

Comments
 (0)