MCPcopy Create free account
hub / github.com/numpy/numpy / block

Method block

numpy/core/tests/test_shape_base.py:519–542  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

517class TestBlock:
518 @pytest.fixture(params=['block', 'force_concatenate', 'force_slicing'])
519 def block(self, request):
520 # blocking small arrays and large arrays go through different paths.
521 # the algorithm is triggered depending on the number of element
522 # copies required.
523 # We define a test fixture that forces most tests to go through
524 # both code paths.
525 # Ultimately, this should be removed if a single algorithm is found
526 # to be faster for both small and large arrays.
527 def _block_force_concatenate(arrays):
528 arrays, list_ndim, result_ndim, _ = _block_setup(arrays)
529 return _block_concatenate(arrays, list_ndim, result_ndim)
530
531 def _block_force_slicing(arrays):
532 arrays, list_ndim, result_ndim, _ = _block_setup(arrays)
533 return _block_slicing(arrays, list_ndim, result_ndim)
534
535 if request.param == 'force_concatenate':
536 return _block_force_concatenate
537 elif request.param == 'force_slicing':
538 return _block_force_slicing
539 elif request.param == 'block':
540 return block
541 else:
542 raise ValueError('Unknown blocking request. There is a typo in the tests.')
543
544 def test_returns_copy(self, block):
545 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