示例#1
0
文件: test_thrift.py 项目: pearu/rbc
def test_myenum_transport(server):
    conn = Client(**socket_options)
    s = conn.thrift.MyEnum.MyONE
    r = conn(test=dict(test_myenum_transport=(s,)))
    assert r['test']['test_myenum_transport'] == s
    s = conn.thrift.MyEnum.MyTWO
    r = conn(test=dict(test_myenum_transport=(s,)))
    assert r['test']['test_myenum_transport'] == s
示例#2
0
文件: test_thrift.py 项目: pearu/rbc
def test_bool_transport(server):
    conn = Client(**socket_options)
    s = True
    r = conn(test=dict(test_bool_transport=(s,)))
    assert r['test']['test_bool_transport'] == s

    s = False
    r = conn(test=dict(test_bool_transport=(s,)))
    assert r['test']['test_bool_transport'] == s
示例#3
0
文件: test_thrift.py 项目: pearu/rbc
def test_ndarray_transport(server):
    conn = Client(**socket_options)
    arr = np.array([1, 2, 3, 4], dtype=np.int64)
    r = conn(test=dict(test_ndarray_transport=(arr,)))
    np.testing.assert_equal(r['test']['test_ndarray_transport'], arr)

    arr = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float64)
    r = conn(test=dict(test_ndarray_transport=(arr,)))
    np.testing.assert_equal(r['test']['test_ndarray_transport'], arr)
示例#4
0
文件: test_thrift.py 项目: pearu/rbc
def test_int16_transport(server):
    conn = Client(**socket_options)
    s = 16
    r = conn(test=dict(test_int16_transport=(s,)))
    assert r['test']['test_int16_transport'] == s
示例#5
0
文件: test_thrift.py 项目: pearu/rbc
def test_str_transport(server):
    conn = Client(**socket_options)
    s = 'hello'
    r = conn(test=dict(test_str_transport=(s,)))
    assert r['test']['test_str_transport'] == s
示例#6
0
文件: test_thrift.py 项目: pearu/rbc
def test_Data_transport2(server):
    conn = Client(**socket_options)
    data = dict(a=1, b=[1, 2, 3], c=dict(d=13.4))
    r = conn(test=dict(test_Data_transport2=(data,)))
    assert r['test']['test_Data_transport2'] == data
示例#7
0
文件: test_thrift.py 项目: pearu/rbc
def test_buffer_transport(server):
    conn = Client(**socket_options)
    arr = np.array([1, 2, 3, 4], dtype=np.int64)
    r = conn(test=dict(test_buffer_transport=(arr,)))
    np.testing.assert_equal(r['test']['test_buffer_transport'],
                            arr.view(np.uint8))
示例#8
0
文件: test_thrift.py 项目: pearu/rbc
def test_void(server):
    conn = Client(**socket_options)
    r = conn(test=dict(test_void=()))
    assert r['test']['test_void'] is None
示例#9
0
文件: test_thrift.py 项目: pearu/rbc
def test_exception(server):
    conn = Client(**socket_options)
    with pytest.raises(
            ValueError,
            match="my exception"):
        conn(test=dict(test_exception=()))
示例#10
0
文件: test_thrift.py 项目: pearu/rbc
def test_map_transport(server):
    conn = Client(**socket_options)
    s = {1: 'one', 2: 'two'}
    r = conn(test=dict(test_map_transport=(s,)))
    assert r['test']['test_map_transport'] == s
示例#11
0
文件: test_thrift.py 项目: pearu/rbc
def test_list_transport(server):
    conn = Client(**socket_options)
    s = [1, 2, 3, 4]
    r = conn(test=dict(test_list_transport=(s,)))
    assert r['test']['test_list_transport'] == s
示例#12
0
文件: test_thrift.py 项目: pearu/rbc
def test_set_transport(server):
    conn = Client(**socket_options)
    s = set(['abc', 'cde'])
    r = conn(test=dict(test_set_transport=(s,)))
    assert r['test']['test_set_transport'] == s
示例#13
0
文件: test_thrift.py 项目: pearu/rbc
def test_double_transport(server):
    conn = Client(**socket_options)
    s = 3.14
    r = conn(test=dict(test_double_transport=(s,)))
    assert r['test']['test_double_transport'] == s
示例#14
0
文件: test_thrift.py 项目: pearu/rbc
def test_int64_transport2(server):
    conn = Client(**socket_options)
    s = 64
    r = conn(test=dict(test_int64_transport2=(s,)))
    assert r['test']['test_int64_transport2'] == s