Skip to content

Commit cf91799

Browse files
committed
[AL-0] Fix S2A validation tests
1 parent af86bc4 commit cf91799

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

labelbox/schema/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Model(DbObject):
1616
"""
1717

1818
name = Field.String("name")
19+
ontology_id = Field.String("ontology_id")
1920
model_runs = Relationship.ToMany("ModelRun", False)
2021

2122
def create_model_run(self, name, config=None) -> "ModelRun":

tests/integration/annotation_import/test_send_to_annotate_mea.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
def test_send_to_annotate_from_model(client, configured_project,
88
model_run_predictions,
9-
model_run_with_data_rows,
10-
project_with_ontology):
9+
model_run_with_data_rows, project):
1110
model_run = model_run_with_data_rows
1211
data_row_ids = [p['dataRow']['id'] for p in model_run_predictions]
1312
assert len(data_row_ids) > 0
1413

15-
destination_project, _ = project_with_ontology
14+
destination_project = project
15+
model = client.get_model(model_run.model_id)
16+
ontology = client.get_ontology(model.ontology_id)
17+
destination_project.setup_editor(ontology)
1618

1719
queues = destination_project.task_queues()
1820
initial_review_task = next(

tests/integration/test_send_to_annotate.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33

44

55
def test_send_to_annotate_include_annotations(
6-
client, configured_batch_project_with_label, project_pack):
6+
client, configured_batch_project_with_label, project_pack, ontology):
77
[source_project, _, data_row, _] = configured_batch_project_with_label
88
destination_project = project_pack[0]
99

10-
source_ontology_builder = OntologyBuilder.from_project(source_project)
11-
editor = list(
12-
client.get_labeling_frontends(
13-
where=LabelingFrontend.name == "editor"))[0]
14-
destination_project.setup(editor, source_ontology_builder.asdict())
10+
src_ontology = source_project.ontology()
11+
destination_project.setup_editor(ontology)
1512

1613
# build an ontology mapping using the top level tools
17-
feature_schema_ids = list(
18-
tool.feature_schema_id for tool in source_ontology_builder.tools)
14+
src_feature_schema_ids = list(
15+
tool.feature_schema_id for tool in src_ontology.tools())
16+
dest_ontology = destination_project.ontology()
17+
dest_feature_schema_ids = list(
18+
tool.feature_schema_id for tool in dest_ontology.tools())
1919
# create a dictionary of feature schema id to itself
20-
ontology_mapping = dict(zip(feature_schema_ids, feature_schema_ids))
20+
ontology_mapping = dict(zip(src_feature_schema_ids,
21+
dest_feature_schema_ids))
2122

2223
try:
2324
queues = destination_project.task_queues()

0 commit comments

Comments
 (0)