Skip to content

Commit

Permalink
Merge pull request #64 from FrancescElies/cesc/fix-test
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
esc committed Jun 23, 2017
2 parents 3e30211 + 090b133 commit 0584ee8
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/test_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ def test_decode_blosc_header_deactivate_shuffle():


def test_decode_blosc_header_uncompressible_data():
array_ = np.asarray(np.random.randn(23),
array_ = np.asarray(np.random.randn(255),
dtype=np.float32).tostring()
blosc_args = BloscArgs()
blosc_args.shuffle = True
compressed = blosc.compress(array_, **blosc_args)
header = decode_blosc_header(compressed)
expected = {'versionlz': 1,
'blocksize': 88,
'blocksize': 1016,
'ctbytes': len(array_) + 16, # original + 16 header bytes
'version': 2,
'flags': 0x13, # 1 for shuffle 2 for non-compressed 4 for small blocksize
Expand All @@ -172,6 +172,25 @@ def test_decode_blosc_header_uncompressible_data():
nt.assert_equal(expected, header)


def test_decode_blosc_header_uncompressible_data_dont_split_false():
array_ = np.asarray(np.random.randn(256),
dtype=np.float32).tostring()
blosc_args = BloscArgs()
blosc_args.shuffle = True
compressed = blosc.compress(array_, **blosc_args)
header = decode_blosc_header(compressed)
expected = {
'versionlz': 1,
'version': 2,
'blocksize': 1024,
'ctbytes': len(array_) + 16, # original + 16 header bytes
'flags': 0x3, # 1 for shuffle 2 for non-compressed
'nbytes': len(array_),
'typesize': blosc_args.typesize
}
nt.assert_equal(expected, header)


def test_BloscPackHeader_constructor_exceptions():
# uses nose test generators

Expand Down

0 comments on commit 0584ee8

Please sign in to comment.