Skip to content

Commit ff495a0

Browse files
committed
Added project type validaiton on item_context
1 parent 1c009ab commit ff495a0

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ minversion = 3.7
33
log_cli=true
44
python_files = test_*.py
55
;pytest_plugins = ['pytest_profiling']
6-
addopts = -n 4 --dist loadscope
6+
;addopts = -n 4 --dist loadscope

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,6 +3714,10 @@ def item_context(
37143714
folder = self.controller.get_folder_by_id(path[1], project.id).data
37153715
else:
37163716
raise AppException("Invalid path provided.")
3717+
if project.type != ProjectType.MULTIMODAL:
3718+
raise AppException(
3719+
"This function is only supported for Multimodal projects."
3720+
)
37173721
if isinstance(item, int):
37183722
_item = self.controller.get_item_by_id(item_id=item, project=project)
37193723
else:

tests/integration/annotations/test_large_annotations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import logging
23
import os
34
import tempfile
45
from pathlib import Path
@@ -8,6 +9,9 @@
89
from tests import DATA_SET_PATH
910
from tests.integration.base import BaseTestCase
1011

12+
13+
logging.basicConfig(level=logging.DEBUG)
14+
1115
sa = SAClient()
1216

1317

tests/integration/items/test_item_context.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,3 @@ def test_overwrite_false(self):
8585
# test from folder by project and folder ids as tuple and item id
8686
item = sa.search_items(f"{self.PROJECT_NAME}/folder", "dummy")[0]
8787
self._base_test((self._project["id"], folder["id"]), item["id"])
88-
89-
90-
def test_():
91-
p_name = "gg"
92-
i_name = "ii"
93-
sa.delete_items(p_name)
94-
sa.attach_items(p_name, [{"name": i_name, "url": "url"}])
95-
size_in_mb = 16
96-
bytes_per_mb = 1048576
97-
size_in_bytes = size_in_mb * bytes_per_mb
98-
with sa.item_context(p_name, i_name, overwrite=True) as ic:
99-
ic.set_component_value("component_id_1", "A" * size_in_bytes)
100-
101-
with sa.item_context(p_name, i_name, overwrite=True) as ic:
102-
assert len(ic.get_component_value("component_id_1")) == size_in_bytes

0 commit comments

Comments
 (0)