Implement REUSE with SPDX identifiers
[normand.git] / tests / test_trans_gz_bz2.py
CommitLineData
d2d06893
MJ
1# SPDX-FileCopyrightText: 2023 Philippe Proulx <eeppeliteloop@gmail.com>
2# SPDX-License-Identifier: MIT
cd33dfe6
PP
3
4import bz2
5import gzip
6import typing
7
8import normand
9
10
11def _test_comp(type: str, dec_func: typing.Callable[[bytes], bytes]):
12 data = b"bonjour tout le monde \x00\x23\x42 \x17" + b"\x7b" * 500
13 ntext = "!t {} {} !end".format(type, data.hex())
14 res = normand.parse(ntext)
15 assert dec_func(res.data) == data
16
17
18def test_gz():
19 _test_comp("gz", gzip.decompress)
20
21
22def test_bz2():
23 _test_comp("bz2", bz2.decompress)
This page took 0.023888 seconds and 4 git commands to generate.