Skip to content

Commit cde2f2a

Browse files
author
Val Brodsky
committed
PR refactor test
1 parent 1ed861c commit cde2f2a

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

tests/integration/annotation_import/conftest.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,6 @@ def dataset_pdf_entity(client, rand_gen, pdf_entity_row_data):
177177
dataset.delete()
178178

179179

180-
@pytest.fixture
181-
def configured_project_pdf_entity(client, ontology, rand_gen,
182-
dataset_pdf_entity):
183-
project = client.create_project(name=rand_gen(str),
184-
queue_mode=QueueMode.Dataset)
185-
186-
editor = list(
187-
client.get_labeling_frontends(
188-
where=LabelingFrontend.name == "editor"))[0]
189-
project.setup(editor, ontology)
190-
191-
dataset, data_row_ids = dataset_pdf_entity
192-
project.datasets.connect(dataset)
193-
project.data_row_ids = data_row_ids
194-
yield project
195-
project.delete()
196-
197-
198180
@pytest.fixture
199181
def configured_project_without_data_rows(client, configured_project, rand_gen):
200182
project = client.create_project(name=rand_gen(str),

tests/integration/annotation_import/test_bulk_import_request.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ def test_pdf_mal_bbox(client, configured_project_pdf):
293293
assert import_annotations.errors == []
294294

295295

296-
def test_pdf_document_entity(client, configured_project_pdf_entity,
297-
dataset_pdf_entity):
296+
def test_pdf_document_entity(client, configured_project_without_data_rows,
297+
dataset_pdf_entity, rand_gen):
298298
# for content "Metal-insulator (MI) transitions have been one of the" in OCR JSON extract tests/assets/arxiv-pdf_data_99-word-token-pdfs_0801.3483-lb-textlayer.json
299299
document_text_selection = DocumentTextSelection(
300300
groupId="2f4336f4-a07e-4e0a-a9e1-5629b03b719b",
@@ -317,6 +317,12 @@ def test_pdf_document_entity(client, configured_project_pdf_entity,
317317

318318
labels = []
319319
_, data_row_uids = dataset_pdf_entity
320+
configured_project_without_data_rows.create_batch(
321+
rand_gen(str),
322+
data_row_uids, # sample of data row objects
323+
5 # priority between 1(Highest) - 5(lowest)
324+
)
325+
320326
for data_row_uid in data_row_uids:
321327
labels.append(
322328
Label(data=TextData(uid=data_row_uid),
@@ -326,7 +332,7 @@ def test_pdf_document_entity(client, configured_project_pdf_entity,
326332

327333
import_annotations = MALPredictionImport.create_from_objects(
328334
client=client,
329-
project_id=configured_project_pdf_entity.uid,
335+
project_id=configured_project_without_data_rows.uid,
330336
name=f"import {str(uuid.uuid4())}",
331337
predictions=labels)
332338
import_annotations.wait_until_done()

tests/integration/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ def image_url(client):
173173

174174
@pytest.fixture(scope="session")
175175
def pdf_url(client):
176-
return client.upload_file('tests/assets/loremipsum.pdf')
176+
pdf_url = client.upload_file('tests/assets/loremipsum.pdf')
177+
return {"row_data": {"pdf_url": pdf_url,}, "global_key": str(uuid.uuid4())}
177178

178179

179180
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)