(self, shape, dtype, order, align)
| 9795 | # NDEBUG mode for size-0 arrays (gh-12503) |
| 9796 | |
| 9797 | def check(self, shape, dtype, order, align): |
| 9798 | err_msg = repr((shape, dtype, order, align)) |
| 9799 | x = _aligned_zeros(shape, dtype, order, align=align) |
| 9800 | if align is None: |
| 9801 | align = np.dtype(dtype).alignment |
| 9802 | assert_equal(x.__array_interface__['data'][0] % align, 0) |
| 9803 | if hasattr(shape, '__len__'): |
| 9804 | assert_equal(x.shape, shape, err_msg) |
| 9805 | else: |
| 9806 | assert_equal(x.shape, (shape,), err_msg) |
| 9807 | assert_equal(x.dtype, dtype) |
| 9808 | if order == "C": |
| 9809 | assert_(x.flags.c_contiguous, err_msg) |
| 9810 | elif order == "F": |
| 9811 | if x.size > 0: |
| 9812 | assert_(x.flags.f_contiguous, err_msg) |
| 9813 | elif order is None: |
| 9814 | assert_(x.flags.c_contiguous, err_msg) |
| 9815 | else: |
| 9816 | raise ValueError() |
| 9817 | |
| 9818 | def test_various_alignments(self): |
| 9819 | for align in [1, 2, 3, 4, 8, 12, 16, 32, 64, None]: |
no test coverage detected