22
33import msgpack
44import numpy as np
5- from ciftools .binary .decoder import decode_cif_data
6- from ciftools .binary .encoding .impl .binary_cif_encoder import BinaryCIFEncoder
7- from ciftools .binary .encoding .impl .encoders .byte_array import BYTE_ARRAY_CIF_ENCODER
8- from ciftools .binary .encoding .impl .encoders .delta import DELTA_CIF_ENCODER
9- from ciftools .binary .encoding .impl .encoders .fixed_point import FixedPointCIFEncoder
5+ from ciftools .bin .decoder import decode_cif_data
6+ from ciftools .bin .encoder import BYTE_ARRAY , DELTA , FixedPoint , Compose
107
118
129class TestEncodings_FixedPoint (unittest .TestCase ):
@@ -20,8 +17,8 @@ def test(self):
2017 ]
2118
2219 for test_arr , e in test_suite :
23- encoder = BinaryCIFEncoder ([ FixedPointCIFEncoder (10 ** e ), BYTE_ARRAY_CIF_ENCODER ] )
24- encoded = encoder .encode_cif_data (test_arr )
20+ encoder = Compose ( FixedPoint (10 ** e ), BYTE_ARRAY )
21+ encoded = encoder .encode (test_arr )
2522 decoded = decode_cif_data (encoded )
2623
2724 self .assertTrue (np .allclose (test_arr , decoded , atol = 10 ** (- e )))
@@ -39,8 +36,8 @@ def test(self):
3936 ]
4037
4138 for test_arr , e in test_suite :
42- encoder = BinaryCIFEncoder ([ FixedPointCIFEncoder (10 ** e ), DELTA_CIF_ENCODER , BYTE_ARRAY_CIF_ENCODER ] )
43- encoded = encoder .encode_cif_data (test_arr )
39+ encoder = Compose ( FixedPoint (10 ** e ), DELTA , BYTE_ARRAY )
40+ encoded = encoder .encode (test_arr )
4441 msgpack .loads (msgpack .dumps (encoded ))
4542 decoded = decode_cif_data (encoded )
4643
0 commit comments