@@ -27,32 +27,16 @@ def test_check_valid_image_with_unaccepted_formats(self):
27
27
for image in images_to_test :
28
28
self .assertFalse (self .project .check_valid_image (f"tests/images/{ image } " ))
29
29
30
- def test_upload_raises_upload_image_error_response_200 (self ):
30
+ def test_upload_raises_upload_image_error (self ):
31
31
responses .add (
32
32
responses .POST ,
33
33
f"{ API_URL } /dataset/{ PROJECT_NAME } /upload?api_key={ ROBOFLOW_API_KEY } " f"&batch={ DEFAULT_BATCH_NAME } " ,
34
34
json = {
35
- "message" : "Invalid Image" ,
36
- "type" : "InvalidImageException" ,
37
- },
38
- status = 200 ,
39
- )
40
-
41
- with self .assertRaises (ImageUploadError ) as error :
42
- self .project .upload (
43
- "tests/images/rabbit.JPG" ,
44
- annotation_path = "tests/annotations/valid_annotation.json" ,
45
- )
46
-
47
- self .assertEqual (str (error .exception ), "Invalid Image" )
48
-
49
- def test_upload_raises_upload_image_error_response_400 (self ):
50
- responses .add (
51
- responses .POST ,
52
- f"{ API_URL } /dataset/{ PROJECT_NAME } /upload?api_key={ ROBOFLOW_API_KEY } " f"&batch={ DEFAULT_BATCH_NAME } " ,
53
- json = {
54
- "message" : "Invalid Image" ,
55
- "type" : "InvalidImageException" ,
35
+ "error" : {
36
+ "message" : "Invalid image." ,
37
+ "type" : "InvalidImageException" ,
38
+ "hint" : "This image was already annotated; to overwrite the annotation, pass overwrite=true..."
39
+ }
56
40
},
57
41
status = 400 ,
58
42
)
@@ -63,7 +47,7 @@ def test_upload_raises_upload_image_error_response_400(self):
63
47
annotation_path = "tests/annotations/valid_annotation.json" ,
64
48
)
65
49
66
- self .assertEqual (str (error .exception ), "Invalid Image " )
50
+ self .assertEqual (str (error .exception ), "Invalid image. " )
67
51
68
52
def test_upload_raises_upload_annotation_error (self ):
69
53
image_id = "hbALkCFdNr9rssgOUXug"
@@ -82,9 +66,11 @@ def test_upload_raises_upload_annotation_error(self):
82
66
responses .POST ,
83
67
f"{ API_URL } /dataset/{ PROJECT_NAME } /annotate/{ image_id } ?api_key={ ROBOFLOW_API_KEY } " f"&name={ image_name } " ,
84
68
json = {
85
- "message" : "Image was already annotated." ,
86
- "type" : "InvalidImageException" ,
87
- "hint" : "This image was already annotated; to overwrite the annotation, pass overwrite=true..." ,
69
+ "error" : {
70
+ "message" : "Image was already annotated." ,
71
+ "type" : "InvalidImageException" ,
72
+ "hint" : "This image was already annotated; to overwrite the annotation, pass overwrite=true..."
73
+ }
88
74
},
89
75
status = 400 ,
90
76
)
0 commit comments