From 2b19bba2df079b7b667669fb996a8fd982130334 Mon Sep 17 00:00:00 2001 From: Karol Jamrozy Date: Sat, 16 Nov 2024 01:30:57 +0100 Subject: [PATCH 1/3] [PTDT-0] Update tests to contain classifications field for TextAnswer --- .../tests/data/annotation_import/conftest.py | 80 ++++++++++++++++--- 1 file changed, 70 insertions(+), 10 deletions(-) diff --git a/libs/labelbox/tests/data/annotation_import/conftest.py b/libs/labelbox/tests/data/annotation_import/conftest.py index c87cb9043..a5acfb2dd 100644 --- a/libs/labelbox/tests/data/annotation_import/conftest.py +++ b/libs/labelbox/tests/data/annotation_import/conftest.py @@ -2071,7 +2071,10 @@ def expected_export_v2_image(): { "name": "text", "value": "text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, ], "relationships": [], @@ -2103,7 +2106,10 @@ def expected_export_v2_audio(): { "name": "text", "value": "text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, ], "segments": {}, @@ -2120,7 +2126,10 @@ def expected_export_v2_html(): { "name": "text", "value": "text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, { "name": "checklist", @@ -2180,7 +2189,10 @@ def expected_export_v2_text(): { "name": "text", "value": "text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, ], "relationships": [], @@ -2328,7 +2340,40 @@ def expected_export_v2_document(): { "name": "text", "value": "text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, + }, + ], + "relationships": [], + } + return expected_annotations + + +@pytest.fixture() +def expected_export_v2_llm_prompt_creation(): + expected_annotations = { + "objects": [], + "classifications": [ + { + "name": + "checklist", + "value": + "checklist", + "checklist_answers": [{ + "name": "option1", + "value": "option1", + "classifications": [] + }], + }, + { + "name": "text", + "value": "text", + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, ], "relationships": [], @@ -2344,11 +2389,17 @@ def expected_export_v2_llm_prompt_response_creation(): { "name": "prompt-text", "value": "prompt-text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, { "name": "response-text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, "value": "response-text", }, { @@ -2390,7 +2441,10 @@ def expected_export_v2_llm_prompt_creation(): { "name": "prompt-text", "value": "prompt-text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, ], "relationships": [], @@ -2406,7 +2460,10 @@ def expected_export_v2_llm_response_creation(): "classifications": [ { "name": "response-text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, "value": "response-text", }, { @@ -2518,7 +2575,10 @@ def expected_exports_v2_mmc(mmc_example_data_row_message_ids): { "name": "text", "value": "text", - "text_answer": {"content": "free form text..."}, + "text_answer": { + "content": "free form text...", + "classifications": [] + }, }, { "name": "radio_index", From efc4a001acda8d660200d70a45524da6f6704d87 Mon Sep 17 00:00:00 2001 From: Karol Jamrozy Date: Wed, 20 Nov 2024 20:46:49 +0100 Subject: [PATCH 2/3] Fix annotation import tests for document --- libs/labelbox/tests/data/annotation_import/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/labelbox/tests/data/annotation_import/conftest.py b/libs/labelbox/tests/data/annotation_import/conftest.py index a5acfb2dd..96156185e 100644 --- a/libs/labelbox/tests/data/annotation_import/conftest.py +++ b/libs/labelbox/tests/data/annotation_import/conftest.py @@ -2313,10 +2313,12 @@ def expected_export_v2_document(): "left": 58.0, "height": 65.0, "width": 12.0, + "unit": "points", }, "page_dimensions": { "height": 792.0, "width": 612.0, + "unit": "points", }, }, ], From 667224f8629bdc49162ebd600272334cc4ad6d88 Mon Sep 17 00:00:00 2001 From: Karol Jamrozy Date: Wed, 20 Nov 2024 21:04:25 +0100 Subject: [PATCH 3/3] Fix lint --- .../tests/data/annotation_import/conftest.py | 50 ++++--------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/libs/labelbox/tests/data/annotation_import/conftest.py b/libs/labelbox/tests/data/annotation_import/conftest.py index 96156185e..d76cb9959 100644 --- a/libs/labelbox/tests/data/annotation_import/conftest.py +++ b/libs/labelbox/tests/data/annotation_import/conftest.py @@ -2073,7 +2073,7 @@ def expected_export_v2_image(): "value": "text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, ], @@ -2108,7 +2108,7 @@ def expected_export_v2_audio(): "value": "text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, ], @@ -2128,7 +2128,7 @@ def expected_export_v2_html(): "value": "text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, { @@ -2191,7 +2191,7 @@ def expected_export_v2_text(): "value": "text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, ], @@ -2344,37 +2344,7 @@ def expected_export_v2_document(): "value": "text", "text_answer": { "content": "free form text...", - "classifications": [] - }, - }, - ], - "relationships": [], - } - return expected_annotations - - -@pytest.fixture() -def expected_export_v2_llm_prompt_creation(): - expected_annotations = { - "objects": [], - "classifications": [ - { - "name": - "checklist", - "value": - "checklist", - "checklist_answers": [{ - "name": "option1", - "value": "option1", - "classifications": [] - }], - }, - { - "name": "text", - "value": "text", - "text_answer": { - "content": "free form text...", - "classifications": [] + "classifications": [], }, }, ], @@ -2393,14 +2363,14 @@ def expected_export_v2_llm_prompt_response_creation(): "value": "prompt-text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, { "name": "response-text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, "value": "response-text", }, @@ -2445,7 +2415,7 @@ def expected_export_v2_llm_prompt_creation(): "value": "prompt-text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, ], @@ -2464,7 +2434,7 @@ def expected_export_v2_llm_response_creation(): "name": "response-text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, "value": "response-text", }, @@ -2579,7 +2549,7 @@ def expected_exports_v2_mmc(mmc_example_data_row_message_ids): "value": "text", "text_answer": { "content": "free form text...", - "classifications": [] + "classifications": [], }, }, {