Skip to content

Commit 7b4b514

Browse files
authored
Merge pull request #356 from Labelbox/DIAG-1131
update to project upsert instructions to no longer remove old ontolog…
2 parents 73ca08d + b890b8e commit 7b4b514

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

labelbox/schema/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def upsert_instructions(self, instructions_file: str):
346346

347347
lfo = list(self.labeling_frontend_options())[-1]
348348
instructions_url = self.client.upload_file(instructions_file)
349-
customization_options = json.loads(lfo.customization_options)
349+
customization_options = self.ontology().normalized
350350
customization_options['projectInstructions'] = instructions_url
351351
option_id = lfo.uid
352352

tests/data/assets/loremipsum.pdf

33.8 KB
Binary file not shown.

tests/integration/test_project.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@ def test_attach_instructions(client, project):
103103
assert "instructions_file must end with one of" in str(exc_info.value)
104104

105105

106+
def test_same_ontology_after_instructions(
107+
client, configured_project_with_complex_ontology):
108+
project, _ = configured_project_with_complex_ontology
109+
initial_ontology = project.ontology().normalized
110+
project.upsert_instructions('tests/data/assets/loremipsum.pdf')
111+
updated_ontology = project.ontology().normalized
112+
113+
instructions = updated_ontology.pop('projectInstructions')
114+
115+
assert initial_ontology == updated_ontology
116+
assert instructions is not None
117+
118+
106119
def test_queued_data_row_export(configured_project):
107120
result = configured_project.export_queued_data_rows()
108121
assert len(result) == 1

0 commit comments

Comments
 (0)