1616 "width": 1024,
1717 "height": 683,
1818 "status": "Completed",
19- "pinned": False ,
20- "isPredicted": None ,
21- "projectId": None ,
22- "annotatorEmail": None ,
23- "qaEmail": None
19+ "pinned": false ,
20+ "isPredicted": null ,
21+ "projectId": null ,
22+ "annotatorEmail": null ,
23+ "qaEmail": null
2424 },
2525 "instances": [
2626 {
3535 },
3636 "groupId": 0,
3737 "pointLabels": {},
38- "locked": False ,
39- "visible": False ,
38+ "locked": false ,
39+ "visible": false ,
4040 "attributes": [
4141 {
4242 "id": 117845,
4646 }
4747 ],
4848 "trackingId": "aaa97f80c9e54a5f2dc2e920fc92e5033d9af45b",
49- "error": None ,
50- "createdAt": None ,
51- "createdBy": None ,
52- "creationType": None ,
53- "updatedAt": None ,
54- "updatedBy": None ,
49+ "error": null ,
50+ "createdAt": null ,
51+ "createdBy": null ,
52+ "creationType": null ,
53+ "updatedAt": null ,
54+ "updatedBy": null ,
5555 "className": "Personal vehicle"
5656 }
5757 ]
@@ -76,7 +76,7 @@ def test_validate_annotation_with_wrong_bbox(self):
7676 vector_json .write (VECTOR_ANNOTATION_JSON_WITH_BBOX )
7777 with catch_prints () as out :
7878 sa .validate_annotations ("Vector" , os .path .join (self .vector_folder_path , f"{ tmpdir_name } /vector.json" ))
79- self .assertEqual ("instances[0].points[x1]fieldrequired " , out .getvalue ().strip ().replace (" " , "" ))
79+ self .assertIn ("instances[0].points.x1fieldrequired " , out .getvalue ().strip ().replace (" " , "" ))
8080
8181 def test_validate_annotation_without_metadata (self ):
8282 with tempfile .TemporaryDirectory () as tmpdir_name :
@@ -89,7 +89,7 @@ def test_validate_annotation_without_metadata(self):
8989 self .assertIn ("metadatafieldrequired" , out .getvalue ().strip ().replace (" " , "" ))
9090
9191 def test_validate_annotation_invalid_date_time_format (self ):
92- with self .assertRaisesRegexp (ValidationError ,"Expected format: YYYY-mm-ddTHH :MM:SS.055Z " ):
92+ with self .assertRaisesRegexp (ValidationError ,"does not match expected format YYYY-MM-DDTHH :MM:SS.fffZ " ):
9393 TimedBaseModel (createdAt = "2021-11-02T15:11:50.065000Z" )
9494
9595 def test_validate_annotation_valid_date_time_format (self ):
@@ -187,7 +187,7 @@ def test_validate_document_annotation(self):
187187 "annotatorEmail": null,
188188 "qaEmail": null,
189189 "lastAction": {
190- "email": "some.email@gmail.com"
190+ "email": "some.email@gmail.com",
191191 "timestamp": 1636620976450
192192 }
193193 },
@@ -208,7 +208,7 @@ def test_validate_pixel_annotation(self):
208208 {
209209 "metadata": {
210210 "lastAction": {
211- "email": "some.email@gmail.com"
211+ "email": "some.email@gmail.com",
212212 "timestamp": 1636627539398
213213 },
214214 "width": 1024,
@@ -269,7 +269,7 @@ def test_validate_vector_empty_annotation(self):
269269 {
270270 "metadata": {
271271 "lastAction": {
272- "email": "shab.prog @gmail.com",
272+ "email": "some.email @gmail.com",
273273 "timestamp": 1636627956948
274274 },
275275 "width": 1024,
@@ -290,3 +290,65 @@ def test_validate_vector_empty_annotation(self):
290290 )
291291 self .assertTrue (sa .validate_annotations ("Vector" , os .path .join (self .vector_folder_path ,
292292 f"{ tmpdir_name } /vector_empty.json" )))
293+
294+ def test_validate_error_message_format (self ):
295+ with tempfile .TemporaryDirectory () as tmpdir_name :
296+ with open (f"{ tmpdir_name } /test_validate_error_message_format.json" , "w" ) as test_validate_error_message_format :
297+ test_validate_error_message_format .write (
298+ '''
299+ {
300+ "metadata": {}
301+ }
302+ '''
303+ )
304+ with catch_prints () as out :
305+ sa .validate_annotations ("Vector" , os .path .join (self .vector_folder_path ,
306+ f"{ tmpdir_name } /test_validate_error_message_format.json" ))
307+ self .assertIn ("metadata.namefieldrequired" , out .getvalue ().strip ().replace (" " , "" ))
308+
309+
310+ def test_validate_document_annotation_wrong_class_id (self ):
311+ with tempfile .TemporaryDirectory () as tmpdir_name :
312+ with open (f"{ tmpdir_name } /test_validate_document_annotation_wrong_class_id.json" , "w" ) as test_validate_document_annotation_wrong_class_id :
313+ test_validate_document_annotation_wrong_class_id .write (
314+ '''
315+ {
316+ "metadata": {
317+ "name": "text_file_example_1",
318+ "status": "NotStarted",
319+ "url": "https://sa-public-files.s3.us-west-2.amazonaws.com/Text+project/text_file_example_1.txt",
320+ "projectId": 167826,
321+ "annotatorEmail": null,
322+ "qaEmail": null,
323+ "lastAction": {
324+ "email": "some.email@gmail.com",
325+ "timestamp": 1636620976450
326+ }
327+ },
328+ "instances": [{
329+ "start": 253,
330+ "end": 593,
331+ "classId": "string",
332+ "createdAt": "2021-10-22T10:40:26.151Z",
333+ "createdBy": {
334+ "email": "some.email@gmail.com",
335+ "role": "Admin"
336+ },
337+ "updatedAt": "2021-10-22T10:40:29.953Z",
338+ "updatedBy": {
339+ "email": "some.email@gmail.com",
340+ "role": "Admin"
341+ },
342+ "attributes": [],
343+ "creationType": "Manual",
344+ "className": "vid"
345+ }],
346+ "tags": [],
347+ "freeText": ""
348+ }
349+ '''
350+ )
351+ with catch_prints () as out :
352+ sa .validate_annotations ("Document" , os .path .join (self .vector_folder_path , f"{ tmpdir_name } /test_validate_document_annotation_wrong_class_id.json" ))
353+ self .assertIn ("instances[0].classIdintegertypeexpected" , out .getvalue ().strip ().replace (" " , "" ))
354+
0 commit comments