Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
[FIX] Fixing tests with C-Blosc 1.14.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed Mar 23, 2018
1 parent e7a8bed commit eb478b7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Changes from 1.1.2 to 1.2.0

- Support for Python <= 2.6 or Python <= 3.4 has been deprecated.

- C-Blosc internal sources updated to 1.14.2. Using a C-Blosc library
> 1.14 is important for forward compatibility. For more info see:
http://blosc.org/posts/new-forward-compat-policy/


Changes from 1.1.1 to 1.1.2
===========================
Expand Down
39 changes: 21 additions & 18 deletions bcolz/tests/test_carray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2275,11 +2275,11 @@ def test00(self):
filters = bcolz.filters.keys()
if common.verbose:
print("Checking filters:", filters)
# print "\nsize b uncompressed-->", a.size * a.dtype.itemsize
# print("\nsize b uncompressed-->", a.size * a.dtype.itemsize)
for filter_ in filters:
b = bcolz.carray(a, rootdir=self.rootdir,
cparams=bcolz.cparams(clevel=9, shuffle=filter_))
# print "size b compressed -->", b.cbytes, "with '%s'"%cname
# print("size b compressed -->", b.cbytes, "with '%s'"%cname)
self.assertTrue(sys.getsizeof(b) > b.nbytes,
"compression does not seem to have any overhead")
assert_array_equal(a, b[:], "Arrays are not equal")
Expand All @@ -2293,14 +2293,15 @@ def test01a(self):
filters = bcolz.filters.keys()
if common.verbose:
print("Checking filters:", filters)
# print "\nsize b uncompressed-->", a.size * a.dtype.itemsize
# print("\nsize b uncompressed-->", a.size * a.dtype.itemsize)
for filter_ in filters:
bcolz.cparams.setdefaults(clevel=9, shuffle=filter_)
b = bcolz.carray(a, rootdir=self.rootdir)
# print "size b compressed -->", b.cbytes, "with '%s'"%filter_
self.assertTrue(sys.getsizeof(b) < b.nbytes,
"carray does not seem to compress at all")
assert_array_equal(a, b[:], "Arrays are not equal")
# print("size b compressed -->", b.cbytes, "with '%s'" % filter_)
if filter_ > 0:
self.assertTrue(sys.getsizeof(b) < b.nbytes,
"carray does not seem to compress at all")
assert_array_equal(a, b[:], "Arrays are not equal")
# Remove the array on disk before trying with the next one
if self.disk:
common.remove_tree(self.rootdir)
Expand All @@ -2311,16 +2312,17 @@ def test01b(self):
filters = bcolz.filters.keys()
if common.verbose:
print("Checking filters:", filters)
# print "\nsize b uncompressed-->", a.size * a.dtype.itemsize
#print("\nsize b uncompressed-->", a.size * a.dtype.itemsize)
for filter_ in filters:
bcolz.defaults.cparams = {
'clevel': 9, 'shuffle': filter_, 'cname': "blosclz",
'quantize': 0}
b = bcolz.carray(a, rootdir=self.rootdir)
# print "size b compressed -->", b.cbytes, "with '%s'"%filter_
self.assertTrue(sys.getsizeof(b) < b.nbytes,
"carray does not seem to compress at all")
assert_array_equal(a, b[:], "Arrays are not equal")
#print("size b compressed -->", b.cbytes, "with '%s'" % filter_)
if filter_ > 0:
self.assertTrue(sys.getsizeof(b) < b.nbytes,
"carray does not seem to compress at all")
assert_array_equal(a, b[:], "Arrays are not equal")
# Remove the array on disk before trying with the next one
if self.disk:
common.remove_tree(self.rootdir)
Expand All @@ -2335,16 +2337,17 @@ def test01c(self):
filters = bcolz.filters.keys()
if common.verbose:
print("Checking filters:", filters)
# print "\nsize b uncompressed-->", a.size * a.dtype.itemsize
# print("\nsize b uncompressed-->", a.size * a.dtype.itemsize)
for filter_ in filters:
with bcolz.defaults_ctx(bcolz.cparams(clevel=9, shuffle=filter_)):
self.assertTrue(bcolz.defaults.cparams['shuffle'] == filter_)
b = bcolz.carray(a, rootdir=self.rootdir)
# print "size b compressed -->", b.cbytes, "with '%s'"%filter_
self.assertTrue(bcolz.defaults.cparams['shuffle'] == bcolz.SHUFFLE)
self.assertTrue(sys.getsizeof(b) < b.nbytes,
"carray does not seem to compress at all")
assert_array_equal(a, b[:], "Arrays are not equal")
# print("size b compressed -->", b.cbytes, "with '%s'" % filter_)
if filter_ > 0:
self.assertTrue(bcolz.defaults.cparams['shuffle'] == bcolz.SHUFFLE)
self.assertTrue(sys.getsizeof(b) < b.nbytes,
"carray does not seem to compress at all")
assert_array_equal(a, b[:], "Arrays are not equal")
# Remove the array on disk before trying with the next one
if self.disk:
common.remove_tree(self.rootdir)
Expand Down
2 changes: 1 addition & 1 deletion bcolz/toplevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def print_versions():
if bcolz.dask_here:
print("Dask version: %s" % bcolz.dask.__version__)
else:
print("Dask version: not available "
print("Dask version: not available "
"(version >= %s not detected)" % bcolz.min_dask_version)

print("Python version: %s" % sys.version)
Expand Down

0 comments on commit eb478b7

Please sign in to comment.