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

Method test_complex64_alignment

numpy/core/tests/test_regression.py:2106–2118  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2104 assert_raises(TypeError, np.searchsorted, a, 1)
2105
2106 def test_complex64_alignment(self):
2107 # Issue gh-2668 (trac 2076), segfault on sparc due to misalignment
2108 dtt = np.complex64
2109 arr = np.arange(10, dtype=dtt)
2110 # 2D array
2111 arr2 = np.reshape(arr, (2, 5))
2112 # Fortran write followed by (C or F) read caused bus error
2113 data_str = arr2.tobytes('F')
2114 data_back = np.ndarray(arr2.shape,
2115 arr2.dtype,
2116 buffer=data_str,
2117 order='F')
2118 assert_array_equal(arr2, data_back)
2119
2120 def test_structured_count_nonzero(self):
2121 arr = np.array([0, 1]).astype('i4, (2)i4')[:1]

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
reshapeMethod · 0.80
tobytesMethod · 0.45

Tested by

no test coverage detected