File: test_encode_decode.py

package info (click to toggle)
python-pamqp 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 576 kB
  • sloc: python: 6,026; makefile: 137; xml: 76; sh: 12
file content (16 lines) | stat: -rw-r--r-- 536 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- encoding: utf-8 -*-
import unittest

from pamqp import decode, encode


class EncodeDecodeTests(unittest.TestCase):

    def test_encode_decode_field_table_long_keys(self):
        """Encoding and decoding a field_table with too long keys."""
        # second key is 126 A's + \N{PILE OF POO}
        data = {'A' * 256: 1,
                ((b'A' * 128) + b'\xf0\x9f\x92\xa9').decode('utf-8'): 2}
        encoded = encode.field_table(data)
        decoded = decode.field_table(encoded)[1]
        self.assertIn('A' * 128, decoded)