-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Ingestion Performance (#662)
- Loading branch information
Showing
9 changed files
with
290 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import pytest | ||
|
||
from valor_api import enums, schemas | ||
from valor_api.backend import models | ||
from valor_api.backend.core.annotation import ( | ||
create_annotations, | ||
delete_dataset_annotations, | ||
delete_model_annotations, | ||
) | ||
|
||
|
||
def test_malformed_input_create_annotations(): | ||
|
||
with pytest.raises(ValueError): | ||
create_annotations( | ||
db=None, # type: ignore - testing | ||
annotations=[[schemas.Annotation()], [schemas.Annotation()]], | ||
datum_ids=[1, 2], | ||
models_=[None], | ||
) | ||
|
||
with pytest.raises(ValueError): | ||
create_annotations( | ||
db=None, # type: ignore - testing | ||
annotations=[[schemas.Annotation()]], | ||
datum_ids=[1, 2], | ||
models_=[None], | ||
) | ||
|
||
with pytest.raises(ValueError): | ||
create_annotations( | ||
db=None, # type: ignore - testing | ||
annotations=[[schemas.Annotation()]], | ||
datum_ids=[1], | ||
models_=[None, None], | ||
) | ||
|
||
|
||
def test_malformed_input_delete_dataset_annotations(): | ||
|
||
for status in enums.TableStatus: | ||
if status == enums.TableStatus.DELETING: | ||
continue | ||
|
||
dataset = models.Dataset( | ||
name="dataset", | ||
status=status, | ||
) | ||
|
||
with pytest.raises(RuntimeError): | ||
delete_dataset_annotations(db=None, dataset=dataset) # type: ignore - testing | ||
|
||
|
||
def test_malformed_input_delete_model_annotations(): | ||
|
||
for status in enums.ModelStatus: | ||
if status == enums.ModelStatus.DELETING: | ||
continue | ||
|
||
model = models.Model( | ||
name="model", | ||
status=status, | ||
) | ||
|
||
with pytest.raises(RuntimeError): | ||
delete_model_annotations(db=None, model=model) # type: ignore - testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.