11import pytest
22import json
3+ import requests
34
45from labelbox import Project , LabelingFrontend
56from labelbox .exceptions import InvalidQueryError
@@ -68,8 +69,11 @@ def test_extend_reservations(project):
6869
6970
7071def test_attach_instructions (client , project ):
71- with pytest .raises (ValueError ):
72- project .attach_instructions ('/tmp/instructions.txt' )
72+ with pytest .raises (ValueError ) as execinfo :
73+ project .upsert_instructions ('/tmp/instructions.txt' )
74+ assert str (
75+ execinfo .value
76+ ) == "Cannot attach instructions to a project that has not been set up."
7377
7478 editor = list (
7579 client .get_labeling_frontends (
@@ -80,10 +84,11 @@ def test_attach_instructions(client, project):
8084 with open ('/tmp/instructions.txt' , 'w' ) as file :
8185 file .write ("some instructions..." )
8286
83- project .attach_instructions ('/tmp/instructions.txt' )
87+ project .upsert_instructions ('/tmp/instructions.txt' )
8488 assert json .loads (
8589 list (project .labeling_frontend_options ())
8690 [- 1 ].customization_options ).get ('projectInstructions' ) is not None
8791
88- with pytest .raises (ValueError ):
89- project .attach_instructions ('/tmp/file.invalid_file_extension' )
92+ with pytest .raises (ValueError ) as execinfo :
93+ project .upsert_instructions ('/tmp/file.invalid_file_extension' )
94+ assert "instructions_file must end with one of" in str (execinfo .value )
0 commit comments