11import uuid
22import pytest
3- from labelbox import parser
43
54from labelbox .schema .annotation_import import AnnotationImportState , LabelImport
65"""
109"""
1110
1211
13- def test_create_with_url_arg (client , configured_project_with_one_data_row ,
14- annotation_import_test_helpers ):
15- name = str (uuid .uuid4 ())
16- url = "https://storage.googleapis.com/labelbox-public-bucket/predictions_test_v2.ndjson"
17- label_import = LabelImport .create (
18- client = client ,
19- id = configured_project_with_one_data_row .uid ,
20- name = name ,
21- url = url )
22- assert label_import .parent_id == configured_project_with_one_data_row .uid
23- annotation_import_test_helpers .check_running_state (label_import , name , url )
24-
25-
2612def test_create_from_url (client , configured_project_with_one_data_row ,
2713 annotation_import_test_helpers ):
2814 name = str (uuid .uuid4 ())
@@ -36,22 +22,6 @@ def test_create_from_url(client, configured_project_with_one_data_row,
3622 annotation_import_test_helpers .check_running_state (label_import , name , url )
3723
3824
39- def test_create_with_labels_arg (client , configured_project , object_predictions ,
40- annotation_import_test_helpers ):
41- """this test should check running state only to validate running, not completed"""
42- name = str (uuid .uuid4 ())
43-
44- label_import = LabelImport .create (client = client ,
45- id = configured_project .uid ,
46- name = name ,
47- labels = object_predictions )
48-
49- assert label_import .parent_id == configured_project .uid
50- annotation_import_test_helpers .check_running_state (label_import , name )
51- annotation_import_test_helpers .assert_file_content (
52- label_import .input_file_url , object_predictions )
53-
54-
5525def test_create_from_objects (client , configured_project , object_predictions ,
5626 annotation_import_test_helpers ):
5727 """this test should check running state only to validate running, not completed"""
@@ -69,42 +39,20 @@ def test_create_from_objects(client, configured_project, object_predictions,
6939 label_import .input_file_url , object_predictions )
7040
7141
72- def test_create_with_path_arg (client , tmp_path , project , object_predictions ,
73- annotation_import_test_helpers ):
74- name = str (uuid .uuid4 ())
75- file_name = f"{ name } .ndjson"
76- file_path = tmp_path / file_name
77- with file_path .open ("w" ) as f :
78- parser .dump (object_predictions , f )
79-
80- label_import = LabelImport .create (client = client ,
81- id = project .uid ,
82- name = name ,
83- path = str (file_path ))
84-
85- assert label_import .parent_id == project .uid
86- annotation_import_test_helpers .check_running_state (label_import , name )
87- annotation_import_test_helpers .assert_file_content (
88- label_import .input_file_url , object_predictions )
89-
90-
91- def test_create_from_local_file (client , tmp_path , project , object_predictions ,
92- annotation_import_test_helpers ):
93- name = str (uuid .uuid4 ())
94- file_name = f"{ name } .ndjson"
95- file_path = tmp_path / file_name
96- with file_path .open ("w" ) as f :
97- parser .dump (object_predictions , f )
42+ # TODO: add me when we add this ability
43+ # def test_create_from_local_file(client, tmp_path, project,
44+ # object_predictions, annotation_import_test_helpers):
45+ # name = str(uuid.uuid4())
46+ # file_name = f"{name}.ndjson"
47+ # file_path = tmp_path / file_name
48+ # with file_path.open("w") as f:
49+ # ndjson.dump(object_predictions, f)
9850
99- label_import = LabelImport .create_from_url (client = client ,
100- project_id = project .uid ,
101- name = name ,
102- url = str (file_path ))
51+ # label_import = LabelImport.create_from_url(client=client, project_id=project.uid, name=name, url=str(file_path))
10352
104- assert label_import .parent_id == project .uid
105- annotation_import_test_helpers .check_running_state (label_import , name )
106- annotation_import_test_helpers .assert_file_content (
107- label_import .input_file_url , object_predictions )
53+ # assert label_import.parent_id == project.uid
54+ # annotation_import_test_helpers.check_running_state(label_import, name)
55+ # annotation_import_test_helpers.assert_file_content(label_import.input_file_url, object_predictions)
10856
10957
11058def test_get (client , configured_project_with_one_data_row ,
0 commit comments