@@ -170,27 +170,32 @@ def test_convert_jef_to_xxx(self):
170170 self .addCleanup (os .remove , file1 )
171171 self .addCleanup (os .remove , file2 )
172172
173- def test_jef_stop_write (self ):
174- file2 = "stop2 .jef"
175- write_jef (get_simple_stop (), file2 )
176- s_pattern = read_jef (file2 )
173+ def test_jef_stop_write_simple (self ):
174+ file = "stop .jef"
175+ write_jef (get_simple_stop (), file )
176+ s_pattern = read_jef (file )
177177 self .assertEqual (s_pattern .count_stitch_commands (STOP ), 1 )
178178 self .assertEqual (s_pattern .count_color_changes (), 0 )
179+ self .addCleanup (os .remove , file )
179180
180- file1 = "stop.jef"
181+ def test_jef_stop_write_large (self ):
182+ file = "stop2.jef"
181183 pattern = get_shift_stop_pattern ()
182- write_jef (pattern , file1 )
183- f_pattern = read_jef (file1 )
184+ n_pattern = pattern .get_normalized_pattern ()
185+ self .assertEqual (n_pattern .count_stitch_commands (COLOR_CHANGE ), 15 )
186+ self .assertEqual (n_pattern .count_stitch_commands (STITCH ), 16 * 5 )
187+ self .assertEqual (n_pattern .count_stitch_commands (STOP ), 5 )
188+
189+ write_jef (pattern , file )
190+ f_pattern = read_jef (file )
184191 self .assertIsNotNone (f_pattern )
185192
186- with open (file1 , "rb" ) as f :
193+ with open (file , "rb" ) as f :
187194 f .seek (0x18 )
188195 colors = f .read (1 )
189196 self .assertEqual (ord (colors ), f_pattern .count_color_changes () + f_pattern .count_stitch_commands (STOP ) + 1 )
190197
191- self .assertEqual (f_pattern .count_stitch_commands (COLOR_CHANGE ), 12 )
198+ self .assertEqual (f_pattern .count_stitch_commands (COLOR_CHANGE ), 15 )
192199 self .assertEqual (f_pattern .count_stitch_commands (STITCH ), 16 * 5 )
193- self .assertEqual (f_pattern .count_stitch_commands (STOP ), 6 )
194- self .position_equals (f_pattern .stitches , 0 , - 1 )
195- self .addCleanup (os .remove , file1 )
196- self .addCleanup (os .remove , file2 )
200+ self .assertEqual (f_pattern .count_stitch_commands (STOP ), 5 )
201+ self .addCleanup (os .remove , file )
0 commit comments