def test_timeout_error(client, project):
    time.sleep(60)  #Fails to connect if we don't wait
    with pytest.raises(labelbox.exceptions.TimeoutError) as excinfo:
        query_str = """query getOntology { 
        project (where: {id: $%s}) { 
            ontology { 
                normalized 
                } 
            }
        } """ % (project.uid)
        client.execute(query_str, check_naming=False, timeout=0.01)
예제 #2
0
def test_query_complexity_error(client):
    with pytest.raises(labelbox.exceptions.ValidationFailedError) as excinfo:
        client.execute("{projects {datasets {dataRows {labels {id}}}}}",
                       check_naming=False)
    assert excinfo.value.message == "Query complexity limit exceeded"
예제 #3
0
def test_timeout_error(client):
    with pytest.raises(labelbox.exceptions.TimeoutError) as excinfo:
        client.execute("{projects {id}}", check_naming=False, timeout=0.001)
예제 #4
0
def test_semantic_error(client):
    with pytest.raises(labelbox.exceptions.InvalidQueryError) as excinfo:
        client.execute("query {bbb {id}}", check_naming=False)
    assert excinfo.value.message.startswith("Cannot query field \"bbb\"")
예제 #5
0
def test_syntax_error(client):
    with pytest.raises(labelbox.exceptions.InvalidQueryError) as excinfo:
        client.execute("asda", check_naming=False)
    assert excinfo.value.message.startswith("Syntax Error:")