MCPcopy Index your code
hub / github.com/numpy/numpy / block

Method block

numpy/_core/tests/test_shape_base.py:592–615  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

590class TestBlock:
591 @pytest.fixture(params=['block', 'force_concatenate', 'force_slicing'])
592 def block(self, request):
593 # blocking small arrays and large arrays go through different paths.
594 # the algorithm is triggered depending on the number of element
595 # copies required.
596 # We define a test fixture that forces most tests to go through
597 # both code paths.
598 # Ultimately, this should be removed if a single algorithm is found
599 # to be faster for both small and large arrays.
600 def _block_force_concatenate(arrays):
601 arrays, list_ndim, result_ndim, _ = _block_setup(arrays)
602 return _block_concatenate(arrays, list_ndim, result_ndim)
603
604 def _block_force_slicing(arrays):
605 arrays, list_ndim, result_ndim, _ = _block_setup(arrays)
606 return _block_slicing(arrays, list_ndim, result_ndim)
607
608 if request.param == 'force_concatenate':
609 return _block_force_concatenate
610 elif request.param == 'force_slicing':
611 return _block_force_slicing
612 elif request.param == 'block':
613 return block
614 else:
615 raise ValueError('Unknown blocking request. There is a typo in the tests.')
616
617 def test_returns_copy(self, block):
618 a = np.eye(3)

Callers 9

TestMatrixPowerClass · 0.80
time_nestedMethod · 0.80
time_no_listsMethod · 0.80
time_block2dMethod · 0.80
time_3dMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected