class documentation
class TestNewBufferProtocol: (source)
Test PEP3118 buffers
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
If a user extends a NumPy array before 1.20 and then runs it on NumPy 1.20+. A C-subclassed array might in theory modify the new buffer-info field. This checks that an error is raised if this happens (for buffer export), an error is written on delete... |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Test that alternating export of C- and F-order buffers from an array which is both C- and F-order when relaxed strides is active works. This test defines array in the signature to ensure leaking more references every time the test is run (catching the leak with pytest-leaks). |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | test |
Undocumented |
Method | _check |
Undocumented |
@pytest.mark.parametrize( 'obj', [ np.ones( 3), np.ones( 1, dtype='i,i')[]])
def test_error_if_stored_buffer_info_is_corrupted(self, obj): (source) ¶
def test_error_if_stored_buffer_info_is_corrupted(self, obj): (source) ¶
If a user extends a NumPy array before 1.20 and then runs it on NumPy 1.20+. A C-subclassed array might in theory modify the new buffer-info field. This checks that an error is raised if this happens (for buffer export), an error is written on delete. This is a sanity check to help users transition to safe code, it may be deleted at any point.
@pytest.mark.parametrize( [ 'obj', 'error'], [ pytest.param( np.array( [ 1, 2], dtype=rational), ValueError, id='array'), pytest.param( rational( 1, 2), TypeError, id='scalar')])
def test_export_and_pickle_user_dtype(self, obj, error): (source) ¶
def test_export_and_pickle_user_dtype(self, obj, error): (source) ¶
Undocumented
@pytest.mark.valgrind_error( reason='leaks buffer info cache temporarily.')
def test_relaxed_strides(self, c=np.ones( ( 1, 10, 10), dtype='i8')):
(source)
¶
def test_relaxed_strides(self, c=np.ones(
Undocumented
@pytest.mark.valgrind_error( reason='leaks buffer info cache temporarily.')
@pytest.mark.skipif( not np.ones((10, 1), order='C').flags.f_contiguous, reason='Test is unnecessary (but fails) without relaxed strides.')
def test_relaxed_strides_buffer_info_leak(self, arr=np.ones( ( 1, 10))):
(source)
¶
@pytest.mark.skipif(
def test_relaxed_strides_buffer_info_leak(self, arr=np.ones(
Test that alternating export of C- and F-order buffers from an array which is both C- and F-order when relaxed strides is active works. This test defines array in the signature to ensure leaking more references every time the test is run (catching the leak with pytest-leaks).