Exemplo n.º 1
0
def test_client_delete_corpus(localhost, auth_token):
    client = PGDBClient(localhost, token=auth_token)
    client.start_database('test_database')
    assert 'test' in [x['name'] for x in client.list_corpora('test_database')]
    client.delete_corpus('test')
    assert 'test' not in [x['name'] for x in client.list_corpora('test_database')]

    client.stop_database('test_database')
Exemplo n.º 2
0
def test_client_delete_corpus(localhost):
    client = PGDBClient(localhost)
    client.start_database('test_database')
    assert 'test' in client.list_corpora('test_database')
    client.delete_corpus('test')
    assert 'test' not in client.list_corpora('test_database')

    client.stop_database('test_database')
Exemplo n.º 3
0
def test_client_import(localhost, auth_token):
    client = PGDBClient(localhost, token=auth_token)
    with pytest.raises(ClientError):
        client.import_corpus('test', 'acoustic', 'M', 'test_database')

    client.start_database('test_database')
    client.import_corpus('test', 'acoustic', 'M', 'test_database', blocking=True)

    client.stop_database('test_database')
    assert client.corpus_status('test')['status'] == 'Imported'
    assert 'test' in [x['name'] for x in client.list_corpora('test_database')]
Exemplo n.º 4
0
def test_query_basic(localhost, auth_token):
    client = PGDBClient(localhost, token=auth_token)
    client.start_database('test_database')
    hierarchy = client.hierarchy('test')
    q = client.generate_query(hierarchy.phone)
    q.filter(hierarchy.phone.label == 'aa')
    q.columns(hierarchy.phone.label.column_name('phone_name'))
    results = client.run_query(q, blocking=True)
    assert len(results) > 0
    assert all(x['phone_name'] == 'aa' for x in results)

    client.stop_database('test_database')
Exemplo n.º 5
0
def test_client_import(localhost):
    client = PGDBClient(localhost)
    with pytest.raises(ClientError):
        client.import_corpus('test', 'acoustic', 'M', 'test_database')

    client.start_database('test_database')
    client.import_corpus('test',
                         'acoustic',
                         'M',
                         'test_database',
                         blocking=True)

    client.stop_database('test_database')
    assert client.corpus_status('test') == 'Imported'
    assert 'test' in client.list_corpora('test_database')