module documentation

Test the .npy file format.

Set up:

>>> import sys
>>> from io import BytesIO
>>> from numpy.lib import format
>>>
>>> scalars = [
...     np.uint8,
...     np.int8,
...     np.uint16,
...     np.int16,
...     np.uint32,
...     np.int32,
...     np.uint64,
...     np.int64,
...     np.float32,
...     np.float64,
...     np.complex64,
...     np.complex128,
...     object,
... ]
>>>
>>> basic_arrays = []
>>>
>>> for scalar in scalars:
...     for endian in '<>':
...         dtype = np.dtype(scalar).newbyteorder(endian)
...         basic = np.arange(15).astype(dtype)
...         basic_arrays.extend([
...             np.array([], dtype=dtype),
...             np.array(10, dtype=dtype),
...             basic,
...             basic.reshape((3,5)),
...             basic.reshape((3,5)).T,
...             basic.reshape((3,5))[::-1,::2],
...         ])
...
>>>
>>> Pdescr = [
...     ('x', 'i4', (2,)),
...     ('y', 'f8', (2, 2)),
...     ('z', 'u1')]
>>>
>>>
>>> PbufferT = [
...     ([3,2], [[6.,4.],[6.,4.]], 8),
...     ([4,3], [[7.,5.],[7.,5.]], 9),
...     ]
>>>
>>>
>>> Ndescr = [
...     ('x', 'i4', (2,)),
...     ('Info', [
...         ('value', 'c16'),
...         ('y2', 'f8'),
...         ('Info2', [
...             ('name', 'S2'),
...             ('value', 'c16', (2,)),
...             ('y3', 'f8', (2,)),
...             ('z3', 'u4', (2,))]),
...         ('name', 'S2'),
...         ('z2', 'b1')]),
...     ('color', 'S2'),
...     ('info', [
...         ('Name', 'U8'),
...         ('Value', 'c16')]),
...     ('y', 'f8', (2, 2)),
...     ('z', 'u1')]
>>>
>>>
>>> NbufferT = [
...     ([3,2], (6j, 6., ('nn', [6j,4j], [6.,4.], [1,2]), 'NN', True), 'cc', ('NN', 6j), [[6.,4.],[6.,4.]], 8),
...     ([4,3], (7j, 7., ('oo', [7j,5j], [7.,5.], [2,1]), 'OO', False), 'dd', ('OO', 7j), [[7.,5.],[7.,5.]], 9),
...     ]
>>>
>>>
>>> record_arrays = [
...     np.array(PbufferT, dtype=np.dtype(Pdescr).newbyteorder('<')),
...     np.array(NbufferT, dtype=np.dtype(Ndescr).newbyteorder('<')),
...     np.array(PbufferT, dtype=np.dtype(Pdescr).newbyteorder('>')),
...     np.array(NbufferT, dtype=np.dtype(Ndescr).newbyteorder('>')),
... ]

Test the magic string writing.

>>> format.magic(1, 0)
'\x93NUMPY\x01\x00'
>>> format.magic(0, 0)
'\x93NUMPY\x00\x00'
>>> format.magic(255, 255)
'\x93NUMPY\xff\xff'
>>> format.magic(2, 5)
'\x93NUMPY\x02\x05'

Test the magic string reading.

>>> format.read_magic(BytesIO(format.magic(1, 0)))
(1, 0)
>>> format.read_magic(BytesIO(format.magic(0, 0)))
(0, 0)
>>> format.read_magic(BytesIO(format.magic(255, 255)))
(255, 255)
>>> format.read_magic(BytesIO(format.magic(2, 5)))
(2, 5)

Test the header writing.

>>> for arr in basic_arrays + record_arrays:
...     f = BytesIO()
...     format.write_array_header_1_0(f, arr)   # XXX: arr is not a dict, items gets called on it
...     print(repr(f.getvalue()))
...
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '|u1', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '|u1', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '|i1', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '|i1', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<u2', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<u2', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>u2', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>u2', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<i2', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<i2', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>i2', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>i2', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<u4', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<u4', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>u4', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>u4', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<i4', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<i4', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>i4', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>i4', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<u8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<u8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>u8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>u8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<i8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<i8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>i8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>i8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<f4', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<f4', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>f4', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>f4', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<f8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<f8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>f8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>f8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '<c8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '<c8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': '>c8', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': '>c8', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (0,)}             \n"
"F\x00{'descr': '<c16', 'fortran_order': False, 'shape': ()}               \n"
"F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (15,)}            \n"
"F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (3, 5)}           \n"
"F\x00{'descr': '<c16', 'fortran_order': True, 'shape': (5, 3)}            \n"
"F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (3, 3)}           \n"
"F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (0,)}             \n"
"F\x00{'descr': '>c16', 'fortran_order': False, 'shape': ()}               \n"
"F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (15,)}            \n"
"F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (3, 5)}           \n"
"F\x00{'descr': '>c16', 'fortran_order': True, 'shape': (5, 3)}            \n"
"F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (3, 3)}           \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': 'O', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 3)}            \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (0,)}              \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': ()}                \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (15,)}             \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 5)}            \n"
"F\x00{'descr': 'O', 'fortran_order': True, 'shape': (5, 3)}             \n"
"F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 3)}            \n"
"v\x00{'descr': [('x', '<i4', (2,)), ('y', '<f8', (2, 2)), ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)}         \n"
"\x16\x02{'descr': [('x', '<i4', (2,)),\n           ('Info',\n            [('value', '<c16'),\n             ('y2', '<f8'),\n             ('Info2',\n              [('name', '|S2'),\n               ('value', '<c16', (2,)),\n               ('y3', '<f8', (2,)),\n               ('z3', '<u4', (2,))]),\n             ('name', '|S2'),\n             ('z2', '|b1')]),\n           ('color', '|S2'),\n           ('info', [('Name', '<U8'), ('Value', '<c16')]),\n           ('y', '<f8', (2, 2)),\n           ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)}      \n"
"v\x00{'descr': [('x', '>i4', (2,)), ('y', '>f8', (2, 2)), ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)}         \n"
"\x16\x02{'descr': [('x', '>i4', (2,)),\n           ('Info',\n            [('value', '>c16'),\n             ('y2', '>f8'),\n             ('Info2',\n              [('name', '|S2'),\n               ('value', '>c16', (2,)),\n               ('y3', '>f8', (2,)),\n               ('z3', '>u4', (2,))]),\n             ('name', '|S2'),\n             ('z2', '|b1')]),\n           ('color', '|S2'),\n           ('info', [('Name', '>U8'), ('Value', '>c16')]),\n           ('y', '>f8', (2, 2)),\n           ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)}      \n"
Class BytesIOSRandomSize Undocumented
Function assert_equal_ Undocumented
Function roundtrip Undocumented
Function roundtrip_randsize Undocumented
Function roundtrip_truncated Undocumented
Function test_bad_header Undocumented
Function test_bad_magic_args Undocumented
Function test_compressed_roundtrip Undocumented
Function test_descr_to_dtype Undocumented
Function test_empty_npz Undocumented
Function test_header_growth_axis Undocumented
Function test_huge_header Undocumented
Function test_huge_header_npz Undocumented
Function test_large_archive Undocumented
Function test_large_file_support Undocumented
Function test_large_header Undocumented
Function test_load_padded_dtype Undocumented
Function test_long_str Undocumented
Function test_memmap_roundtrip Undocumented
Function test_metadata_dtype Undocumented
Function test_pickle_disallow Undocumented
Function test_pickle_python2_python3 Undocumented
Function test_python2_python3_interoperability Undocumented
Function test_read_array_header_1_0 Undocumented
Function test_read_array_header_2_0 Undocumented
Function test_read_magic Undocumented
Function test_read_magic_bad_magic Undocumented
Function test_read_version_1_0_bad_magic Undocumented
Function test_roundtrip Undocumented
Function test_roundtrip_randsize Undocumented
Function test_roundtrip_truncated Undocumented
Function test_unicode_field_names Undocumented
Function test_version_2_0 Undocumented
Function test_version_2_0_memmap Undocumented
Function test_write_version Undocumented
Variable bad_version_magic Undocumented
Variable basic Undocumented
Variable basic_arrays Undocumented
Variable dt1 Undocumented
Variable dt2 Undocumented
Variable dt3 Undocumented
Variable dt4 Undocumented
Variable dt5 Undocumented
Variable dt6 Undocumented
Variable dtype Undocumented
Variable malformed_magic Undocumented
Variable NbufferT Undocumented
Variable Ndescr Undocumented
Variable PbufferT Undocumented
Variable Pdescr Undocumented
Variable record_arrays Undocumented
Variable scalars Undocumented
def assert_equal_(o1, o2): (source)

Undocumented

def roundtrip(arr): (source)

Undocumented

def roundtrip_randsize(arr): (source)

Undocumented

def roundtrip_truncated(arr): (source)

Undocumented

def test_bad_header(): (source)

Undocumented

def test_bad_magic_args(): (source)

Undocumented

def test_compressed_roundtrip(tmpdir): (source)

Undocumented

@pytest.mark.parametrize('dt', [np.dtype(np.dtype([('a', np.int8), ('b', np.int16), ('c', np.int32)], align=True), (3)), np.dtype([('x', np.dtype({'names': ['a', 'b'], 'formats': ['i1', 'i1'], 'offsets': [0, 4], 'itemsize': 8}, (3)), (4))]), np.dtype([('x', ('<f8', (5)), (2))]), np.dtype([('x', np.dtype((np.dtype((np.dtype({'names': ['a', 'b'], 'formats': ['i1', 'i1'], 'offsets': [0, 4], 'itemsize': 8}), (3))), (4))))]), np.dtype([('a', np.dtype((np.dtype((np.dtype((np.dtype([('a', int), ('b', np.dtype({'names': ['a', 'b'], 'formats': ['i1', 'i1'], 'offsets': [0, 4], 'itemsize': 8}))]), (3))), (4))), (5))))])])
def test_descr_to_dtype(dt): (source)

Undocumented

def test_empty_npz(tmpdir): (source)

Undocumented

def test_header_growth_axis(): (source)

Undocumented

@pytest.mark.parametrize('mmap_mode', ['r', None])
def test_huge_header(tmpdir, mmap_mode): (source)

Undocumented

def test_huge_header_npz(tmpdir): (source)

Undocumented

@pytest.mark.skipif(IS_PYPY, reason='flaky on PyPy')
@pytest.mark.skipif((np.dtype(np.intp).itemsize < 8), reason='test requires 64-bit system')
@pytest.mark.slow
@requires_memory(free_bytes=2*2**30)
def test_large_archive(tmpdir): (source)

Undocumented

def test_large_file_support(tmpdir): (source)

Undocumented

def test_large_header(): (source)

Undocumented

@pytest.mark.parametrize('dt', [dt1, dt2, dt3, dt4, dt5, dt6])
def test_load_padded_dtype(tmpdir, dt): (source)

Undocumented

def test_long_str(): (source)

Undocumented

@pytest.mark.skipif(IS_WASM, reason='memmap doesn\'t work correctly')
@pytest.mark.slow
def test_memmap_roundtrip(tmpdir): (source)

Undocumented

@pytest.mark.parametrize('dt, fail', [(np.dtype({'names': ['a', 'b'], 'formats': [float, np.dtype('S3', metadata={'some': 'stuff'})]}), True), (np.dtype(int, metadata={'some': 'stuff'}), False), (np.dtype([('subarray', (int, (2)))], metadata={'some': 'stuff'}), False), (np.dtype({'names': ['a', 'b'], 'formats': [float, np.dtype({'names': ['c'], 'formats': [np.dtype(int, metadata={})]})]}), False)])
@pytest.mark.skipif(IS_PYPY and (sys.implementation.version <= (7, 3, 8)), reason='PyPy bug in error formatting')
def test_metadata_dtype(dt, fail): (source)

Undocumented

def test_pickle_disallow(tmpdir): (source)

Undocumented

def test_pickle_python2_python3(): (source)

Undocumented

@pytest.mark.xfail(IS_WASM, reason='Emscripten NODEFS has a buggy dup')
def test_python2_python3_interoperability(): (source)

Undocumented

def test_read_array_header_1_0(): (source)

Undocumented

def test_read_array_header_2_0(): (source)

Undocumented

def test_read_magic(): (source)

Undocumented

def test_read_magic_bad_magic(): (source)

Undocumented

def test_read_version_1_0_bad_magic(): (source)

Undocumented

def test_roundtrip(): (source)

Undocumented

def test_roundtrip_randsize(): (source)

Undocumented

def test_roundtrip_truncated(): (source)

Undocumented

def test_unicode_field_names(tmpdir): (source)

Undocumented

def test_version_2_0(): (source)

Undocumented

@pytest.mark.skipif(IS_WASM, reason='memmap doesn\'t work correctly')
def test_version_2_0_memmap(tmpdir): (source)

Undocumented

def test_write_version(): (source)

Undocumented

bad_version_magic: list[bytes] = (source)

Undocumented

Undocumented

basic_arrays: list = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

malformed_magic: list[bytes] = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

record_arrays = (source)

Undocumented

Undocumented