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)
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"
def test_timeout_error(client): with pytest.raises(labelbox.exceptions.TimeoutError) as excinfo: client.execute("{projects {id}}", check_naming=False, timeout=0.001)
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\"")
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:")