1010"""
1111
1212
13- def test_create_from_url (model_run_with_model_run_data_rows ,
13+ def test_create_from_url (client , model_run_with_model_run_data_rows ,
1414 annotation_import_test_helpers ):
1515 name = str (uuid .uuid4 ())
1616 url = "https://storage.googleapis.com/labelbox-public-bucket/predictions_test_v2.ndjson"
@@ -19,9 +19,20 @@ def test_create_from_url(model_run_with_model_run_data_rows,
1919 assert annotation_import .model_run_id == model_run_with_model_run_data_rows .uid
2020 annotation_import_test_helpers .check_running_state (annotation_import , name ,
2121 url )
22-
23-
24- def test_create_from_objects (model_run_with_model_run_data_rows ,
22+ import_id = client .execute (
23+ """query get_mea_importPyApi($model_run_id: ID!) {
24+ modelErrorAnalysisPredictionImports(where: {modelRunId: $model_run_id}) {
25+ id
26+ }}""" , {"model_run_id" : annotation_import .parent_id
27+ })['modelErrorAnalysisPredictionImports' ][0 ]['id' ]
28+ client .execute (
29+ """mutation deleteModelErrorAnalysisPredictionImportPyApi($import_id: ID!) {
30+ deleteModelErrorAnalysisPredictionImport(where: {id: $import_id}) {
31+ id
32+ }}""" , {"import_id" : import_id })
33+
34+
35+ def test_create_from_objects (client , model_run_with_model_run_data_rows ,
2536 object_predictions ,
2637 annotation_import_test_helpers ):
2738 name = str (uuid .uuid4 ())
@@ -33,9 +44,21 @@ def test_create_from_objects(model_run_with_model_run_data_rows,
3344 annotation_import_test_helpers .check_running_state (annotation_import , name )
3445 annotation_import_test_helpers .assert_file_content (
3546 annotation_import .input_file_url , object_predictions )
36-
37-
38- def test_create_from_local_file (tmp_path , model_run_with_model_run_data_rows ,
47+ import_id = client .execute (
48+ """query get_mea_importPyApi($model_run_id: ID!) {
49+ modelErrorAnalysisPredictionImports(where: {modelRunId: $model_run_id}) {
50+ id
51+ }}""" , {"model_run_id" : annotation_import .parent_id
52+ })['modelErrorAnalysisPredictionImports' ][0 ]['id' ]
53+ client .execute (
54+ """mutation deleteModelErrorAnalysisPredictionImportPyApi($import_id: ID!) {
55+ deleteModelErrorAnalysisPredictionImport(where: {id: $import_id}) {
56+ id
57+ }}""" , {"import_id" : import_id })
58+
59+
60+ def test_create_from_local_file (client , tmp_path ,
61+ model_run_with_model_run_data_rows ,
3962 object_predictions ,
4063 annotation_import_test_helpers ):
4164 name = str (uuid .uuid4 ())
@@ -51,6 +74,17 @@ def test_create_from_local_file(tmp_path, model_run_with_model_run_data_rows,
5174 annotation_import_test_helpers .check_running_state (annotation_import , name )
5275 annotation_import_test_helpers .assert_file_content (
5376 annotation_import .input_file_url , object_predictions )
77+ import_id = client .execute (
78+ """query get_mea_importPyApi($model_run_id: ID!) {
79+ modelErrorAnalysisPredictionImports(where: {modelRunId: $model_run_id}) {
80+ id
81+ }}""" , {"model_run_id" : annotation_import .parent_id
82+ })['modelErrorAnalysisPredictionImports' ][0 ]['id' ]
83+ client .execute (
84+ """mutation deleteModelErrorAnalysisPredictionImportPyApi($import_id: ID!) {
85+ deleteModelErrorAnalysisPredictionImport(where: {id: $import_id}) {
86+ id
87+ }}""" , {"import_id" : import_id })
5488
5589
5690def test_get (client , model_run_with_model_run_data_rows ,
@@ -66,6 +100,17 @@ def test_get(client, model_run_with_model_run_data_rows,
66100 assert annotation_import .model_run_id == model_run_with_model_run_data_rows .uid
67101 annotation_import_test_helpers .check_running_state (annotation_import , name ,
68102 url )
103+ import_id = client .execute (
104+ """query get_mea_importPyApi($model_run_id: ID!) {
105+ modelErrorAnalysisPredictionImports(where: {modelRunId: $model_run_id}) {
106+ id
107+ }}""" , {"model_run_id" : annotation_import .parent_id
108+ })['modelErrorAnalysisPredictionImports' ][0 ]['id' ]
109+ client .execute (
110+ """mutation deleteModelErrorAnalysisPredictionImportPyApi($import_id: ID!) {
111+ deleteModelErrorAnalysisPredictionImport(where: {id: $import_id}) {
112+ id
113+ }}""" , {"import_id" : import_id })
69114
70115
71116@pytest .mark .slow
0 commit comments