blob: 9da3a38dc6cb3ccfa9255eab2bea6e63d17fa0c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
from netlib import encoding
def test_identity():
assert "string" == encoding.decode("identity", "string")
assert "string" == encoding.encode("identity", "string")
assert not encoding.encode("nonexistent", "string")
assert None == encoding.decode("nonexistent encoding", "string")
def test_gzip():
assert b"string" == encoding.decode(
"gzip",
encoding.encode(
"gzip",
b"string"
)
)
assert encoding.decode("gzip", b"bogus") is None
def test_deflate():
assert b"string" == encoding.decode(
"deflate",
encoding.encode(
"deflate",
b"string"
)
)
assert b"string" == encoding.decode(
"deflate",
encoding.encode(
"deflate",
b"string"
)[2:-4]
)
assert encoding.decode("deflate", b"bogus") is None
|