Пример #1
0
def test_pack_large_data():
    packed = Fields.pack_data([
        b"97f0f004be65439846e0eae3e67edacbaa6e578d1e8ba1e3d2f57e18460967d1" \
        b"433bd920e7e9221c4a4631f59730096f73f8df748b990c24dec2714ba8ade446" \
        b"28eeffe47b54447c452f1bebdc6a21e00f576daca1ec2c1f991fc3c465c7b493" \
        b"900e8c8bc79b772f47802d2fb7424dec7aae835c2802974802e5a4a1b79dcb63" \
        b"a7c18846a1171d8e2150ce804b68a7db02810a058159",
        b"e7d536e3f67ce32a6e4a439880d28010df2199459b4e2836e272fba1d8597479" \
        b"ff76db462267029601579310a36e49b2bc34aade017f57e4d40f110abea1a1bd" \
        b"f4a17a1e20f28fe3751e83ffd3dc383b6e965e3a9f5d28d4378d31fa70dda065" \
        b"1fa09ab1fc3a817148da42b3dcbeb4264d1ec6a7385abf3b9598459b337bbf6a" \
        b"41fb49769e20735e5842fcb1e3ee1d19bfd2e7e249f5"
    ])
    assert packed == \
        b"\x02\x00\xFF\x2C\x01\x39\x37\x66\x30\x66\x30\x30\x34\x62\x65\x36" \
        b"\x35\x34\x33\x39\x38\x34\x36\x65\x30\x65\x61\x65\x33\x65\x36\x37" \
        b"\x65\x64\x61\x63\x62\x61\x61\x36\x65\x35\x37\x38\x64\x31\x65\x38" \
        b"\x62\x61\x31\x65\x33\x64\x32\x66\x35\x37\x65\x31\x38\x34\x36\x30" \
        b"\x39\x36\x37\x64\x31\x34\x33\x33\x62\x64\x39\x32\x30\x65\x37\x65" \
        b"\x39\x32\x32\x31\x63\x34\x61\x34\x36\x33\x31\x66\x35\x39\x37\x33" \
        b"\x30\x30\x39\x36\x66\x37\x33\x66\x38\x64\x66\x37\x34\x38\x62\x39" \
        b"\x39\x30\x63\x32\x34\x64\x65\x63\x32\x37\x31\x34\x62\x61\x38\x61" \
        b"\x64\x65\x34\x34\x36\x32\x38\x65\x65\x66\x66\x65\x34\x37\x62\x35" \
        b"\x34\x34\x34\x37\x63\x34\x35\x32\x66\x31\x62\x65\x62\x64\x63\x36" \
        b"\x61\x32\x31\x65\x30\x30\x66\x35\x37\x36\x64\x61\x63\x61\x31\x65" \
        b"\x63\x32\x63\x31\x66\x39\x39\x31\x66\x63\x33\x63\x34\x36\x35\x63" \
        b"\x37\x62\x34\x39\x33\x39\x30\x30\x65\x38\x63\x38\x62\x63\x37\x39" \
        b"\x62\x37\x37\x32\x66\x34\x37\x38\x30\x32\x64\x32\x66\x62\x37\x34" \
        b"\x32\x34\x64\x65\x63\x37\x61\x61\x65\x38\x33\x35\x63\x32\x38\x30" \
        b"\x32\x39\x37\x34\x38\x30\x32\x65\x35\x61\x34\x61\x31\x62\x37\x39" \
        b"\x64\x63\x62\x36\x33\x61\x37\x63\x31\x38\x38\x34\x36\x61\x31\x31" \
        b"\x37\x31\x64\x38\x65\x32\x31\x35\x30\x63\x65\x38\x30\x34\x62\x36" \
        b"\x38\x61\x37\x64\x62\x30\x32\x38\x31\x30\x61\x30\x35\x38\x31\x35" \
        b"\x39\xFF\x2C\x01\x65\x37\x64\x35\x33\x36\x65\x33\x66\x36\x37\x63" \
        b"\x65\x33\x32\x61\x36\x65\x34\x61\x34\x33\x39\x38\x38\x30\x64\x32" \
        b"\x38\x30\x31\x30\x64\x66\x32\x31\x39\x39\x34\x35\x39\x62\x34\x65" \
        b"\x32\x38\x33\x36\x65\x32\x37\x32\x66\x62\x61\x31\x64\x38\x35\x39" \
        b"\x37\x34\x37\x39\x66\x66\x37\x36\x64\x62\x34\x36\x32\x32\x36\x37" \
        b"\x30\x32\x39\x36\x30\x31\x35\x37\x39\x33\x31\x30\x61\x33\x36\x65" \
        b"\x34\x39\x62\x32\x62\x63\x33\x34\x61\x61\x64\x65\x30\x31\x37\x66" \
        b"\x35\x37\x65\x34\x64\x34\x30\x66\x31\x31\x30\x61\x62\x65\x61\x31" \
        b"\x61\x31\x62\x64\x66\x34\x61\x31\x37\x61\x31\x65\x32\x30\x66\x32" \
        b"\x38\x66\x65\x33\x37\x35\x31\x65\x38\x33\x66\x66\x64\x33\x64\x63" \
        b"\x33\x38\x33\x62\x36\x65\x39\x36\x35\x65\x33\x61\x39\x66\x35\x64" \
        b"\x32\x38\x64\x34\x33\x37\x38\x64\x33\x31\x66\x61\x37\x30\x64\x64" \
        b"\x61\x30\x36\x35\x31\x66\x61\x30\x39\x61\x62\x31\x66\x63\x33\x61" \
        b"\x38\x31\x37\x31\x34\x38\x64\x61\x34\x32\x62\x33\x64\x63\x62\x65" \
        b"\x62\x34\x32\x36\x34\x64\x31\x65\x63\x36\x61\x37\x33\x38\x35\x61" \
        b"\x62\x66\x33\x62\x39\x35\x39\x38\x34\x35\x39\x62\x33\x33\x37\x62" \
        b"\x62\x66\x36\x61\x34\x31\x66\x62\x34\x39\x37\x36\x39\x65\x32\x30" \
        b"\x37\x33\x35\x65\x35\x38\x34\x32\x66\x63\x62\x31\x65\x33\x65\x65" \
        b"\x31\x64\x31\x39\x62\x66\x64\x32\x65\x37\x65\x32\x34\x39\x66\x35"
Пример #2
0
def test_pack_large_data():
    packed = Fields.pack_data([
        b"97f0f004be65439846e0eae3e67edacbaa6e578d1e8ba1e3d2f57e18460967d1"
        b"433bd920e7e9221c4a4631f59730096f73f8df748b990c24dec2714ba8ade446"
        b"28eeffe47b54447c452f1bebdc6a21e00f576daca1ec2c1f991fc3c465c7b493"
        b"900e8c8bc79b772f47802d2fb7424dec7aae835c2802974802e5a4a1b79dcb63"
        b"a7c18846a1171d8e2150ce804b68a7db02810a058159",
        b"e7d536e3f67ce32a6e4a439880d28010df2199459b4e2836e272fba1d8597479"
        b"ff76db462267029601579310a36e49b2bc34aade017f57e4d40f110abea1a1bd"
        b"f4a17a1e20f28fe3751e83ffd3dc383b6e965e3a9f5d28d4378d31fa70dda065"
        b"1fa09ab1fc3a817148da42b3dcbeb4264d1ec6a7385abf3b9598459b337bbf6a"
        b"41fb49769e20735e5842fcb1e3ee1d19bfd2e7e249f5"
    ])
    assert packed == \
        b"\x02\x00\xFF\x2C\x01\x39\x37\x66\x30\x66\x30\x30\x34\x62\x65\x36" \
        b"\x35\x34\x33\x39\x38\x34\x36\x65\x30\x65\x61\x65\x33\x65\x36\x37" \
        b"\x65\x64\x61\x63\x62\x61\x61\x36\x65\x35\x37\x38\x64\x31\x65\x38" \
        b"\x62\x61\x31\x65\x33\x64\x32\x66\x35\x37\x65\x31\x38\x34\x36\x30" \
        b"\x39\x36\x37\x64\x31\x34\x33\x33\x62\x64\x39\x32\x30\x65\x37\x65" \
        b"\x39\x32\x32\x31\x63\x34\x61\x34\x36\x33\x31\x66\x35\x39\x37\x33" \
        b"\x30\x30\x39\x36\x66\x37\x33\x66\x38\x64\x66\x37\x34\x38\x62\x39" \
        b"\x39\x30\x63\x32\x34\x64\x65\x63\x32\x37\x31\x34\x62\x61\x38\x61" \
        b"\x64\x65\x34\x34\x36\x32\x38\x65\x65\x66\x66\x65\x34\x37\x62\x35" \
        b"\x34\x34\x34\x37\x63\x34\x35\x32\x66\x31\x62\x65\x62\x64\x63\x36" \
        b"\x61\x32\x31\x65\x30\x30\x66\x35\x37\x36\x64\x61\x63\x61\x31\x65" \
        b"\x63\x32\x63\x31\x66\x39\x39\x31\x66\x63\x33\x63\x34\x36\x35\x63" \
        b"\x37\x62\x34\x39\x33\x39\x30\x30\x65\x38\x63\x38\x62\x63\x37\x39" \
        b"\x62\x37\x37\x32\x66\x34\x37\x38\x30\x32\x64\x32\x66\x62\x37\x34" \
        b"\x32\x34\x64\x65\x63\x37\x61\x61\x65\x38\x33\x35\x63\x32\x38\x30" \
        b"\x32\x39\x37\x34\x38\x30\x32\x65\x35\x61\x34\x61\x31\x62\x37\x39" \
        b"\x64\x63\x62\x36\x33\x61\x37\x63\x31\x38\x38\x34\x36\x61\x31\x31" \
        b"\x37\x31\x64\x38\x65\x32\x31\x35\x30\x63\x65\x38\x30\x34\x62\x36" \
        b"\x38\x61\x37\x64\x62\x30\x32\x38\x31\x30\x61\x30\x35\x38\x31\x35" \
        b"\x39\xFF\x2C\x01\x65\x37\x64\x35\x33\x36\x65\x33\x66\x36\x37\x63" \
        b"\x65\x33\x32\x61\x36\x65\x34\x61\x34\x33\x39\x38\x38\x30\x64\x32" \
        b"\x38\x30\x31\x30\x64\x66\x32\x31\x39\x39\x34\x35\x39\x62\x34\x65" \
        b"\x32\x38\x33\x36\x65\x32\x37\x32\x66\x62\x61\x31\x64\x38\x35\x39" \
        b"\x37\x34\x37\x39\x66\x66\x37\x36\x64\x62\x34\x36\x32\x32\x36\x37" \
        b"\x30\x32\x39\x36\x30\x31\x35\x37\x39\x33\x31\x30\x61\x33\x36\x65" \
        b"\x34\x39\x62\x32\x62\x63\x33\x34\x61\x61\x64\x65\x30\x31\x37\x66" \
        b"\x35\x37\x65\x34\x64\x34\x30\x66\x31\x31\x30\x61\x62\x65\x61\x31" \
        b"\x61\x31\x62\x64\x66\x34\x61\x31\x37\x61\x31\x65\x32\x30\x66\x32" \
        b"\x38\x66\x65\x33\x37\x35\x31\x65\x38\x33\x66\x66\x64\x33\x64\x63" \
        b"\x33\x38\x33\x62\x36\x65\x39\x36\x35\x65\x33\x61\x39\x66\x35\x64" \
        b"\x32\x38\x64\x34\x33\x37\x38\x64\x33\x31\x66\x61\x37\x30\x64\x64" \
        b"\x61\x30\x36\x35\x31\x66\x61\x30\x39\x61\x62\x31\x66\x63\x33\x61" \
        b"\x38\x31\x37\x31\x34\x38\x64\x61\x34\x32\x62\x33\x64\x63\x62\x65" \
        b"\x62\x34\x32\x36\x34\x64\x31\x65\x63\x36\x61\x37\x33\x38\x35\x61" \
        b"\x62\x66\x33\x62\x39\x35\x39\x38\x34\x35\x39\x62\x33\x33\x37\x62" \
        b"\x62\x66\x36\x61\x34\x31\x66\x62\x34\x39\x37\x36\x39\x65\x32\x30" \
        b"\x37\x33\x35\x65\x35\x38\x34\x32\x66\x63\x62\x31\x65\x33\x65\x65" \
        b"\x31\x64\x31\x39\x62\x66\x64\x32\x65\x37\x65\x32\x34\x39\x66\x35"
Пример #3
0
def test_pack_data():
    packed = Fields.pack_data(["Hello", "World"])
    assert packed == \
        b"\x02\x00\x05\x48\x65\x6c\x6c\x6f\x05\x57\x6f\x72\x6c\x64"
Пример #4
0
def test_pack_data():
    packed = Fields.pack_data(["Hello", "World"])
    assert packed == \
        b"\x02\x00\x05\x48\x65\x6c\x6c\x6f\x05\x57\x6f\x72\x6c\x64"