def test_disable_offsets(): in_fp, out_fp, dcmp_fp = StringIO(), StringIO(), StringIO() create_array_fp(1, in_fp) in_fp_size = in_fp.tell() in_fp.seek(0) bloscpack_args = BloscpackArgs(offsets=False) source = PlainFPSource(in_fp) sink = CompressedFPSink(out_fp) pack(source, sink, *calculate_nchunks(in_fp_size), bloscpack_args=bloscpack_args) out_fp.seek(0) bloscpack_header, metadata, metadata_header, offsets = _read_beginning(out_fp) nt.assert_true(len(offsets) == 0)
def test_disable_offsets(): in_fp, out_fp, dcmp_fp = StringIO(), StringIO(), StringIO() create_array_fp(1, in_fp) in_fp_size = in_fp.tell() in_fp.seek(0) bloscpack_args = BloscpackArgs(offsets=False) source = PlainFPSource(in_fp) sink = CompressedFPSink(out_fp) pack(source, sink, *calculate_nchunks(in_fp_size), bloscpack_args=bloscpack_args) out_fp.seek(0) bloscpack_header, metadata, metadata_header, offsets = \ _read_beginning(out_fp) nt.assert_true(len(offsets) == 0)
def reset_read_beginning(input_fp): """ like ``_read_beginning`` but with ``seek(0)`` on the file pointer. """ ans = _read_beginning(input_fp) input_fp.seek(0) return ans