77
88
99def setup_function (func ):
10- os .mkdir ('test_images' )
11- os .mkdir ('test_images/rgb' )
12- os .mkdir ('test_images/gsc' )
10+ paths = ['test_images' , 'test_images/rgb' , 'test_images/gsc' ]
11+ for path in paths :
12+ if not os .path .exists (path ):
13+ os .mkdir (path )
1314
1415 img_w = img_h = 20
1516 for n in range (8 ):
@@ -55,8 +56,9 @@ def test_image_data_generator():
5556 assert x .shape [1 :] == images .shape [1 :]
5657 break
5758
59+
5860def test_img_flip ():
59- x = np .array (range (4 )).reshape ([1 ,1 , 2 , 2 ])
61+ x = np .array (range (4 )).reshape ([1 , 1 , 2 , 2 ])
6062 assert (flip_axis (x , 0 ) == x ).all ()
6163 assert (flip_axis (x , 1 ) == x ).all ()
6264 assert (flip_axis (x , 2 ) == [[[[2 , 3 ], [0 , 1 ]]]]).all ()
@@ -79,8 +81,8 @@ def test_img_flip():
7981 dim_ordering = dim_ordering ).flow (x , [1 ])
8082 for i in range (10 ):
8183 potentially_flipped_x , _ = next (image_generator_th )
82- assert (potentially_flipped_x == x ).all () or \
83- (potentially_flipped_x == flip_axis (x , col_index )).all ()
84+ assert (( potentially_flipped_x == x ).all () or
85+ (potentially_flipped_x == flip_axis (x , col_index )).all () )
8486
8587
8688if __name__ == '__main__' :
0 commit comments