(self, request)
| 517 | class 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) |
no outgoing calls
no test coverage detected