Esempio 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))
Esempio 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))
Esempio 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))
Esempio n. 4
0
def test_unpack_i16():
    b = BytesIO(b"09")
    assert_equal(12345, proto.read_val(b, TType.I16))
Esempio n. 5
0
def test_unpack_i32():
    b = BytesIO(b'I\x96\x02\xd2')
    assert_equal(1234567890, proto.read_val(b, TType.I32))
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))
Esempio n. 7
0
def test_unpack_i8():
    b = BytesIO(b"{")
    assert_equal(123, proto.read_val(b, TType.I08))
def test_unpack_double():
    b = BytesIO(b'A\xd2e\x80\xb4\x87\xe6\xb7')
    assert_equal(1234567890.1234567890, proto.read_val(b, TType.DOUBLE))
def test_unpack_i64():
    b = BytesIO(b'\x11"\x10\xf4}\xe9\x81\x15')
    assert_equal(1234567890123456789, proto.read_val(b, TType.I64))
def test_unpack_i32():
    b = BytesIO(b'I\x96\x02\xd2')
    assert_equal(1234567890, proto.read_val(b, TType.I32))
def test_unpack_i16():
    b = BytesIO(b"09")
    assert_equal(12345, proto.read_val(b, TType.I16))
def test_unpack_i8():
    b = BytesIO(b"{")
    assert_equal(123, proto.read_val(b, TType.I08))