Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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))
Ejemplo n.º 8
0
def test_void(server):
    conn = Client(**socket_options)
    r = conn(test=dict(test_void=()))
    assert r['test']['test_void'] is None
Ejemplo n.º 9
0
def test_exception(server):
    conn = Client(**socket_options)
    with pytest.raises(
            ValueError,
            match="my exception"):
        conn(test=dict(test_exception=()))
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
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
Ejemplo n.º 12
0
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
Ejemplo n.º 13
0
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
Ejemplo n.º 14
0
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