Ejemplo n.º 1
0
def test_unpack_string():
    b = BytesIO(b'\x00\x00\x00\x0c'
                b'\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xb8\x96\xe7\x95\x8c')
    assert_equal(u("你好世界"), proto.read_val(b, TType.STRING))
Ejemplo n.º 2
0
def test_unpack_i64():
    b = BytesIO(b'\x11"\x10\xf4}\xe9\x81\x15')
    assert_equal(1234567890123456789, proto.read_val(b, TType.I64))
Ejemplo n.º 3
0
def test_unpack_double():
    b = BytesIO(b'A\xd2e\x80\xb4\x87\xe6\xb7')
    assert_equal(1234567890.1234567890, proto.read_val(b, TType.DOUBLE))
Ejemplo n.º 4
0
def test_unpack_i16():
    b = BytesIO(b"09")
    assert_equal(12345, proto.read_val(b, TType.I16))
Ejemplo n.º 5
0
def test_unpack_i32():
    b = BytesIO(b'I\x96\x02\xd2')
    assert_equal(1234567890, proto.read_val(b, TType.I32))
Ejemplo n.º 6
0
def test_unpack_string():
    b = BytesIO(b'\x00\x00\x00\x0c'
                b'\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xb8\x96\xe7\x95\x8c')
    assert_equal(u("你好世界"), proto.read_val(b, TType.STRING))
Ejemplo n.º 7
0
def test_unpack_i8():
    b = BytesIO(b"{")
    assert_equal(123, proto.read_val(b, TType.I08))
Ejemplo n.º 8
0
def test_unpack_double():
    b = BytesIO(b'A\xd2e\x80\xb4\x87\xe6\xb7')
    assert_equal(1234567890.1234567890, proto.read_val(b, TType.DOUBLE))
Ejemplo n.º 9
0
def test_unpack_i64():
    b = BytesIO(b'\x11"\x10\xf4}\xe9\x81\x15')
    assert_equal(1234567890123456789, proto.read_val(b, TType.I64))
Ejemplo n.º 10
0
def test_unpack_i32():
    b = BytesIO(b'I\x96\x02\xd2')
    assert_equal(1234567890, proto.read_val(b, TType.I32))
Ejemplo n.º 11
0
def test_unpack_i16():
    b = BytesIO(b"09")
    assert_equal(12345, proto.read_val(b, TType.I16))
Ejemplo n.º 12
0
def test_unpack_i8():
    b = BytesIO(b"{")
    assert_equal(123, proto.read_val(b, TType.I08))