Skip to content

Commit

Permalink
fixtest: without decompress shape, can't run dim test
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Jul 13, 2022
1 parent e09da43 commit 7704edb
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,10 @@

@pytest.mark.parametrize("order", ["C", "F"])
def test_compress_decompress(order):
a = np.linspace(0, 100, num=1000000).reshape((100, 100, 100), order=order)
a = np.linspace(0, 100, num=100**3).reshape((100, 100, 100), order=order)
tolerance = 0.0000001
compressed = compress(a, tolerance=tolerance)
recovered = decompress(compressed, a.shape, a.dtype,
tolerance=tolerance, order=order)
recovered = decompress(compressed, order=order)
a.flags == recovered.flags
assert(a.shape == recovered.shape)
assert(np.allclose(a, recovered))


@pytest.mark.parametrize("order", ["C", "F"])
def test_dim_order(order):
a = np.arange(32, dtype=np.float32).reshape((8, 4), order=order)
compressed = compress(a, rate=8)
recovered = decompress(compressed[0:16], (4, 4), np.dtype('float32'),
rate=8, order=order)
b = np.arange(16, dtype=np.float32).reshape((4, 4), order=order)
assert(np.allclose(recovered, b))


test_compress_decompress('C')
test_compress_decompress('F')
test_dim_order('C')
test_dim_order('F')

0 comments on commit 7704edb

Please sign in to comment.