@@ -21,22 +21,22 @@ def test_error():
2121 enc = f .encode (data )
2222 enc2 = bytearray (enc )
2323 enc2 [0 ] += 1
24- with pytest .raises (ValueError ) as e :
24+ with pytest .raises (RuntimeError ) as e :
2525 f .decode (enc2 )
2626 assert "fletcher32 checksum" in str (e .value )
2727
2828
2929def test_known ():
3030 data = (
31- b'\xf0 4\xfe \x1a \x03 \xb2 \xb1 ?^\x99 j\xf3 \xd6 f\xef ?\xbb m\x04 n'
32- b'\x9a \xdf \xeb ?x\x9e IL\xde W\xc8 ?A\xef \x88 \xa8 &\xad \xef ?'
33- b'\xf2 \xc6 a\x01 a\xb8 \xe8 ?#&\x96 \xab Y\xf2 \xe7 ?\xe2 Pw\xba \xd0 w\xea ?'
34- b'\x80 \xc5 \xf8 M@0\x9a ?\x98 H+\xb4 \x03 \xfa \xc6 ?\xb9 P\x1e 1'
35- )
31+ b'w\x07 \x00 \x00 \x00 \x00 \x00 \x00 \x85 \xf6 \xff \xff \xff \xff \xff \xff '
32+ b'i\x07 \x00 \x00 \x00 \x00 \x00 \x00 \x94 \xf6 \xff \xff \xff \xff \xff \xff '
33+ b'\x88 \t \x00 \x00 \x00 \x00 \x00 \x00 i\x03 \x00 \x00 \x00 \x00 \x00 \x00 '
34+ b'\x93 \xfd \xff \xff \xff \xff \xff \xff \xc3 \xfc \xff \xff \xff \xff \xff \xff '
35+ b"'\x02 \x00 \x00 \x00 \x00 \x00 \x00 \xba \xf7 \xff \xff \xff \xff \xff \xff "
36+ b'\xfd %\x86 d' )
3637 data3 = Fletcher32 ().decode (data )
37- outarr = np .frombuffer (data3 , dtype = "<f8 " )
38+ outarr = np .frombuffer (data3 , dtype = "<i8 " )
3839 expected = [
39- 0.0691225 , 0.98130367 , 0.87104532 , 0.19018153 , 0.9898866 ,
40- 0.77250719 , 0.74833377 , 0.8271259 , 0.02557469 , 0.17950484
40+ 1911 , - 2427 , 1897 , - 2412 , 2440 , 873 , - 621 , - 829 , 551 , - 2118 ,
4141 ]
42- assert np . allclose ( outarr , expected )
42+ assert outarr . tolist () == expected
0 commit comments