MCPcopy
hub / github.com/pandas-dev/pandas / test_split

Method test_split

pandas/tests/internals/test_internals.py:347–364  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

345 assert isinstance(nb[1].values, DatetimeArray)
346
347 def test_split(self):
348 # GH#37799
349 values = np.random.default_rng(2).standard_normal((3, 4))
350 blk = new_block(values, placement=BlockPlacement([3, 1, 6]), ndim=2)
351 result = list(blk._split())
352
353 # check that we get views, not copies
354 values[:] = -9999
355 assert (blk.values == -9999).all()
356
357 assert len(result) == 3
358 expected = [
359 new_block(values[[0]], placement=BlockPlacement([3]), ndim=2),
360 new_block(values[[1]], placement=BlockPlacement([1]), ndim=2),
361 new_block(values[[2]], placement=BlockPlacement([6]), ndim=2),
362 ]
363 for res, exp in zip(result, expected):
364 assert_block_equal(res, exp)
365
366
367class TestBlockManager:

Callers

nothing calls this directly

Calls 4

new_blockFunction · 0.90
assert_block_equalFunction · 0.85
_splitMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected