Skip to content

Commit 6204d5f

Browse files
author
Val Brodsky
committed
Added media_type to test projects
1 parent 244f7ad commit 6204d5f

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

libs/labelbox/tests/data/export/conftest.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import uuid
21
import time
2+
import uuid
3+
34
import pytest
4-
from labelbox.schema.queue_mode import QueueMode
5+
6+
from labelbox.schema.annotation_import import AnnotationImportState, LabelImport
57
from labelbox.schema.labeling_frontend import LabelingFrontend
6-
from labelbox.schema.annotation_import import LabelImport, AnnotationImportState
8+
from labelbox.schema.media_type import MediaType
9+
from labelbox.schema.queue_mode import QueueMode
710

811

912
@pytest.fixture
@@ -247,6 +250,7 @@ def configured_project_with_ontology(
247250
project = client.create_project(
248251
name=rand_gen(str),
249252
queue_mode=QueueMode.Batch,
253+
media_type=MediaType.Image,
250254
)
251255
editor = list(
252256
client.get_labeling_frontends(where=LabelingFrontend.name == "editor")
@@ -274,6 +278,7 @@ def configured_project_without_data_rows(
274278
name=rand_gen(str),
275279
description=rand_gen(str),
276280
queue_mode=QueueMode.Batch,
281+
media_type=MediaType.Image,
277282
)
278283
editor = list(
279284
client.get_labeling_frontends(where=LabelingFrontend.name == "editor")

libs/labelbox/tests/integration/test_client_errors.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import labelbox.client
1010
from labelbox import Project, User
11+
from labelbox.schema.media_type import MediaType
1112

1213

1314
def test_missing_api_key():
@@ -29,7 +30,7 @@ def test_bad_key(rand_gen):
2930
client = labelbox.client.Client(api_key=bad_key)
3031

3132
with pytest.raises(lbox.exceptions.AuthenticationError) as excinfo:
32-
client.create_project(name=rand_gen(str))
33+
client.create_project(name=rand_gen(str), media_type=MediaType.Image)
3334

3435

3536
def test_syntax_error(client):
@@ -77,7 +78,7 @@ def test_network_error(client):
7778
)
7879

7980
with pytest.raises(lbox.exceptions.NetworkError) as excinfo:
80-
client.create_project(name="Project name")
81+
client.create_project(name="Project name", media_type=MediaType.Image)
8182

8283

8384
def test_invalid_attribute_error(
@@ -86,12 +87,12 @@ def test_invalid_attribute_error(
8687
):
8788
# Creation
8889
with pytest.raises(lbox.exceptions.InvalidAttributeError) as excinfo:
89-
client.create_project(name="Name", invalid_field="Whatever")
90+
client.create_project(name="Name", invalid_field="Whatever", media_type=MediaType.Image)
9091
assert excinfo.value.db_object_type == Project
9192
assert excinfo.value.field == "invalid_field"
9293

9394
# Update
94-
project = client.create_project(name=rand_gen(str))
95+
project = client.create_project(name=rand_gen(str), media_type=MediaType.Image)
9596
with pytest.raises(lbox.exceptions.InvalidAttributeError) as excinfo:
9697
project.update(invalid_field="Whatever")
9798
assert excinfo.value.db_object_type == Project

libs/labelbox/tests/integration/test_filtering.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import pytest
22
from lbox.exceptions import InvalidQueryError
3+
from libs.labelbox.src.labelbox.schema.media_type import MediaType
34

45
from labelbox import Project
6+
from labelbox.schema import media_type
57
from labelbox.schema.queue_mode import QueueMode
68

79

@@ -11,9 +13,9 @@ def project_to_test_where(client, rand_gen):
1113
p_b_name = f"b-{rand_gen(str)}"
1214
p_c_name = f"c-{rand_gen(str)}"
1315

14-
p_a = client.create_project(name=p_a_name, queue_mode=QueueMode.Batch)
15-
p_b = client.create_project(name=p_b_name, queue_mode=QueueMode.Batch)
16-
p_c = client.create_project(name=p_c_name, queue_mode=QueueMode.Batch)
16+
p_a = client.create_project(name=p_a_name, media_type=MediaType.Image)
17+
p_b = client.create_project(name=p_b_name, media_type=MediaType.Image)
18+
p_c = client.create_project(name=p_c_name, media_type=MediaType.Image)
1719

1820
yield p_a, p_b, p_c
1921

libs/labelbox/tests/integration/test_legacy_project.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import pytest
22

3+
from labelbox.schema import media_type
4+
from labelbox.schema.media_type import MediaType
35
from labelbox.schema.queue_mode import QueueMode
46

57

@@ -11,6 +13,7 @@ def test_project_dataset(client, rand_gen):
1113
client.create_project(
1214
name=rand_gen(str),
1315
queue_mode=QueueMode.Dataset,
16+
media_type=MediaType.Image,
1417
)
1518

1619

@@ -19,13 +22,13 @@ def test_project_auto_audit_parameters(client, rand_gen):
1922
ValueError,
2023
match="quality_modes must be set instead of auto_audit_percentage or auto_audit_number_of_labels.",
2124
):
22-
client.create_project(name=rand_gen(str), auto_audit_percentage=0.5)
25+
client.create_project(name=rand_gen(str), media_type=MediaType.Image, auto_audit_percentage=0.5)
2326

2427
with pytest.raises(
2528
ValueError,
2629
match="quality_modes must be set instead of auto_audit_percentage or auto_audit_number_of_labels.",
2730
):
28-
client.create_project(name=rand_gen(str), auto_audit_number_of_labels=2)
31+
client.create_project(name=rand_gen(str), media_type=MediaType.Image, auto_audit_number_of_labels=2)
2932

3033

3134
def test_project_name_parameter(client, rand_gen):

0 commit comments

Comments
 (0)