import numpy as np
from pysz import compress, decompress


def test_compress_decompress():
    a = np.linspace(0, 100, num=1000000).reshape((100, 100, 100)).astype(np.float32)
    tolerance = 0.0001
    compressed = compress(a, tolerance=tolerance)

    recovered = decompress(compressed, a.shape, a.dtype)
    
    assert(a.shape == recovered.shape)
    assert(np.allclose(a, recovered, atol=tolerance))


test_compress_decompress()

[((8, 17, 8, 49), 'pysz.compress', 'compress', (), '', False, 'from pysz import compress, decompress\n'), ((10, 16, 10, 56), 'pysz.decompress', 'decompress', ({(10, 27, 10, 37): 'compressed', (10, 39, 10, 46): 'a.shape', (10, 48, 10, 55): 'a.dtype'}, {}), '(compressed, a.shape, a.dtype)', False, 'from pysz import compress, decompress\n'), ((13, 11, 13, 52), 'numpy.allclose', 'np.allclose', (), '', True, 'import numpy as np\n'), ((6, 8, 6, 40), 'numpy.linspace', 'np.linspace', (), '', True, 'import numpy as np\n')]