@@ -26,11 +26,17 @@ def export_path(self):
2626 return os .path .join (dirname (dirname (__file__ )), self .TEST_EXPORT_ROOT )
2727
2828 def test_consensus (self ):
29- annot_types = [' polygon' , ' bbox' , ' point' ]
30- folder_names = [' consensus_1' , ' consensus_2' , ' consensus_3' ]
29+ annot_types = [" polygon" , " bbox" , " point" ]
30+ folder_names = [" consensus_1" , " consensus_2" , " consensus_3" ]
3131 df_column_names = [
32- 'creatorEmail' , 'imageName' , 'instanceId' , 'area' , 'className' ,
33- 'attributes' , 'folderName' , 'score'
32+ "creatorEmail" ,
33+ "imageName" ,
34+ "instanceId" ,
35+ "area" ,
36+ "className" ,
37+ "attributes" ,
38+ "folderName" ,
39+ "score" ,
3440 ]
3541 export_path = self .export_path
3642 for i in range (1 , 4 ):
@@ -39,47 +45,53 @@ def test_consensus(self):
3945 self .PROJECT_NAME , self .export_path + "/classes/classes.json"
4046 )
4147 sa .upload_images_from_folder_to_project (
42- self .PROJECT_NAME , self .export_path + "/images" , annotation_status = "Completed"
48+ self .PROJECT_NAME ,
49+ self .export_path + "/images" ,
50+ annotation_status = "Completed" ,
4351 )
4452 for i in range (1 , 4 ):
4553 sa .upload_images_from_folder_to_project (
46- self .PROJECT_NAME + f' /{ self .CONSENSUS_PREFIX } ' + str (i ),
54+ self .PROJECT_NAME + f" /{ self .CONSENSUS_PREFIX } " + str (i ),
4755 self .export_path + "/images" ,
48- annotation_status = "Completed"
56+ annotation_status = "Completed" ,
4957 )
5058 time .sleep (2 )
51- sa .upload_annotations_from_folder_to_project (self .PROJECT_NAME , self .export_path )
59+ sa .upload_annotations_from_folder_to_project (
60+ self .PROJECT_NAME , self .export_path
61+ )
5262 for i in range (1 , 4 ):
5363 sa .upload_annotations_from_folder_to_project (
54- self .PROJECT_NAME + f' /{ self .CONSENSUS_PREFIX } ' + str (i ),
55- self .export_path + f' /{ self .CONSENSUS_PREFIX } ' + str (i )
64+ self .PROJECT_NAME + f" /{ self .CONSENSUS_PREFIX } " + str (i ),
65+ self .export_path + f" /{ self .CONSENSUS_PREFIX } " + str (i ),
5666 )
5767
5868 for annot_type in annot_types :
59- res_df = sa .consensus (self .PROJECT_NAME , folder_names , annot_type = annot_type )
60- #test content of projectName column
61- assert sorted (res_df ['folderName' ].unique ()) == folder_names
69+ res_df = sa .consensus (
70+ self .PROJECT_NAME , folder_names , annot_type = annot_type
71+ )
72+ # test content of projectName column
73+ assert sorted (res_df ["folderName" ].unique ()) == folder_names
6274
63- #test structure of resulting DataFrame
75+ # test structure of resulting DataFrame
6476 assert sorted (res_df .columns ) == sorted (df_column_names )
6577
66- #test lower bound of the score
67- assert (res_df [' score' ] >= 0 ).all ()
78+ # test lower bound of the score
79+ assert (res_df [" score" ] >= 0 ).all ()
6880
69- #test upper bound of the score
70- assert (res_df [' score' ] <= 1 ).all ()
81+ # test upper bound of the score
82+ assert (res_df [" score" ] <= 1 ).all ()
7183
7284 image_names = [
73- ' bonn_000000_000019_leftImg8bit.png' ,
74- ' bielefeld_000000_000321_leftImg8bit.png'
85+ " bonn_000000_000019_leftImg8bit.png" ,
86+ " bielefeld_000000_000321_leftImg8bit.png" ,
7587 ]
7688
77- #test filtering images with given image names list
89+ # test filtering images with given image names list
7890 res_images = sa .consensus (
7991 self .PROJECT_NAME ,
8092 folder_names ,
8193 export_root = export_path ,
82- image_list = image_names
94+ image_list = image_names ,
8395 )
8496
85- assert sorted (res_images [' imageName' ].unique ()) == sorted (image_names )
97+ assert sorted (res_images [" imageName" ].unique ()) == sorted (image_names )
0 commit comments