def test_decode(self): ctx = hpack.ctx() for example in TestHpack.examples: decoded = ctx.decode_headers(example.encoded) self.assertHeaderListMatchesDict(example.decoded, decoded) ctx = hpack.ctx() for example in TestHpack.examples: decoded = ctx.decode_headers(example.huffman_encoded) self.assertHeaderListMatchesDict(example.decoded, decoded)
def test_encode_with_huffman_encoding(self): ctx = hpack.ctx(huffman_encoding=True) for example in TestHpack.examples: ctx.start_encode() ctx.encode_header_list(example.decoded) encoded = ctx.end_encode() self.assertEqual(encoded, example.huffman_encoded)