예제 #1
0
def test_pack_unpack():
    def check_pack_unpack(packet):
        assert packet.type != -1 
        packed = binarypack.pack(packet)
        assert binarypack.unpack(packed) == packet

    for packet in generate_test_packets():
        yield check_pack_unpack, packet
예제 #2
0
def test_pack_unpack():
    def check_pack_unpack(packet):
        assert packet.type != -1
        packed = binarypack.pack(packet)
        assert binarypack.unpack(packed) == packet

    for packet in generate_test_packets():
        yield check_pack_unpack, packet
예제 #3
0
def test_pack_unpack():
    def check_pack_unpack(packet, numeric_type):
        packed = dictpack.pack(packet, numeric_type)
        assert dictpack.pack(packet, numeric_type) == packed

        unpack_packet, unpack_numeric = dictpack.unpack(packed)
        assert unpack_packet == packet
        assert unpack_numeric == numeric_type

    for packet in generate_test_packets():
        yield check_pack_unpack, packet, True
        yield check_pack_unpack, packet, False
예제 #4
0
def test_pack_unpack():
    def check_pack_unpack(packet, numeric_type):
        packed = dictpack.pack(packet, numeric_type)
        assert dictpack.pack(packet, numeric_type) == packed

        unpack_packet, unpack_numeric = dictpack.unpack(packed)
        assert unpack_packet == packet
        assert unpack_numeric == numeric_type

    for packet in generate_test_packets():
        yield check_pack_unpack, packet, True
        yield check_pack_unpack, packet, False