Skip to content

Commit a4bf399

Browse files
author
Val Brodsky
committed
Raise exception to not allow project to disconnect labeling front end
1 parent e5de933 commit a4bf399

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ class Project(DbObject, Updateable, Deletable):
132132
# Relationships
133133
created_by = Relationship.ToOne("User", False, "created_by")
134134
organization = Relationship.ToOne("Organization", False)
135-
labeling_frontend = Relationship.ToOne("LabelingFrontend")
135+
labeling_frontend = Relationship.ToOne(
136+
"LabelingFrontend",
137+
config=Relationship.Config(disconnect_supported=False))
136138
labeling_frontend_options = Relationship.ToMany(
137139
"LabelingFrontendOptions", False, "labeling_frontend_options")
138140
labeling_parameter_overrides = Relationship.ToMany(

libs/labelbox/tests/integration/test_labeling_frontend.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
from labelbox import LabelingFrontend
21
import pytest
32

3+
from labelbox import LabelingFrontend
4+
from labelbox.exceptions import OperationNotSupportedException
5+
46

57
def test_get_labeling_frontends(client):
68
filtered_frontends = list(
@@ -18,5 +20,5 @@ def test_labeling_frontend_connecting_to_project(project):
1820
project.labeling_frontend.connect(default_labeling_frontend)
1921
assert project.labeling_frontend() == default_labeling_frontend
2022

21-
project.labeling_frontend.disconnect(default_labeling_frontend)
22-
assert project.labeling_frontend() == None
23+
with pytest.raises(OperationNotSupportedException):
24+
project.labeling_frontend.disconnect(default_labeling_frontend)

0 commit comments

Comments
 (0)