From b737547cfc86080f6041b9bfa007587317754de6 Mon Sep 17 00:00:00 2001 From: Dmitrii Lavrukhin Date: Tue, 16 Jul 2024 23:22:15 +0400 Subject: [PATCH] testing almost all formats whether they make folders for subsets --- tests/python/rest_api/test_projects.py | 43 ++++++++++++++++++++------ 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/tests/python/rest_api/test_projects.py b/tests/python/rest_api/test_projects.py index 1f03d26733ea..8bb0f14101b0 100644 --- a/tests/python/rest_api/test_projects.py +++ b/tests/python/rest_api/test_projects.py @@ -816,8 +816,32 @@ def test_can_export_and_import_dataset_after_deleting_related_storage( self._test_import_project(admin_user, project_id, "CVAT 1.1", import_data) - @pytest.mark.parametrize("export_format", ["COCO 1.0", "COCO Keypoints 1.0"]) - def test_creates_subfolders_in_coco_export(self, tasks, admin_user, export_format): + @pytest.mark.parametrize( + "export_format, subset_path_template", + [ + ("COCO 1.0", "images/{subset}/"), + ("COCO Keypoints 1.0", "images/{subset}/"), + ('CVAT for images 1.1', "images/{subset}/"), + ('CVAT for video 1.1', "images/{subset}/"), + ('Datumaro 1.0', "images/{subset}/"), + ('Datumaro 3D 1.0', "point_clouds/{subset}/"), + ('LabelMe 3.0', "{subset}/"), + ('MOTS PNG 1.0', "{subset}/images/"), + ('YOLO 1.1', "obj_{subset}_data/"), + ('CamVid 1.0', "{subset}/"), + ('WiderFace 1.0', "WIDER_{subset}/images/"), + ('VGGFace2 1.0', "{subset}/"), + ('Market-1501 1.0', "bounding_box_{subset}/"), + ('ICDAR Recognition 1.0', "{subset}/images/"), + ('ICDAR Localization 1.0', "{subset}/images/"), + ('ICDAR Segmentation 1.0', "{subset}/images/"), + ('KITTI 1.0', "{subset}/image_2/"), + ('LFW 1.0', "{subset}/images/"), + ('Cityscapes 1.0', "imgsFine/leftImg8bit/{subset}/"), + ('Open Images V6 1.0', "images/{subset}/"), + ], + ) + def test_creates_subfolders_for_subsets_on_export(self, tasks, admin_user, export_format, subset_path_template): group_key_func = itemgetter("project_id") subsets = ["Train", "Validation"] project_id = next( @@ -831,9 +855,10 @@ def test_creates_subfolders_in_coco_export(self, tasks, admin_user, export_forma response = self._test_export_project(admin_user, project_id, format=export_format) with zipfile.ZipFile(io.BytesIO(response.data)) as zip_file: for subset in subsets: + folder_prefix = subset_path_template.format(subset=subset) assert ( - len([f for f in zip_file.namelist() if f.startswith(f"images/{subset}/")]) > 0 - ) + len([f for f in zip_file.namelist() if f.startswith(folder_prefix)]) > 0 + ), f"No {folder_prefix} in {zip_file.namelist()}" @pytest.mark.usefixtures("restore_db_per_function") @@ -1025,8 +1050,8 @@ def test_admin_can_add_skeleton(self, projects, admin_user): } ], "svg": '', + 'cy="36.98698806762695" stroke-width="0.1" data-type="element node" ' + 'data-element-id="1" data-node-id="1" data-label-name="597501">', } prev_lc = get_method(admin_user, "labels", project_id=project["id"]).json()["count"] @@ -1133,7 +1158,7 @@ def test_if_supervisor_or_worker_cannot_see_project_preview( for user in find_users(role=role, exclude_privilege="admin") for project in projects if project["organization"] == user["org"] - and not is_project_staff(user["id"], project["id"]) + and not is_project_staff(user["id"], project["id"]) ) ) @@ -1149,8 +1174,8 @@ def test_if_maintainer_or_owner_can_see_project_preview( for user in find_users(role=role, exclude_privilege="admin") for project in projects if project["organization"] == user["org"] - and not is_project_staff(user["id"], project["id"]) - and project["tasks"]["count"] > 0 + and not is_project_staff(user["id"], project["id"]) + and project["tasks"]["count"] > 0 ) )