@@ -173,25 +173,22 @@ def test_AddDestroyCallback(self):
173173 def foo (dbg_id ):
174174 # Need nonlocal to modify closure variable.
175175 nonlocal called
176- called += [(" foo" , dbg_id )]
176+ called += [(' foo' , dbg_id )]
177177
178178 def bar (dbg_id ):
179179 # Need nonlocal to modify closure variable.
180180 nonlocal called
181- called += [(" bar" , dbg_id )]
181+ called += [(' bar' , dbg_id )]
182182
183183 token_foo = self .dbg .AddDestroyCallback (foo )
184184 token_bar = self .dbg .AddDestroyCallback (bar )
185185 self .dbg .Destroy (self .dbg )
186186
187187 # Should call both `foo()` and `bar()`.
188- self .assertEqual (
189- called ,
190- [
191- ("foo" , original_dbg_id ),
192- ("bar" , original_dbg_id ),
193- ],
194- )
188+ self .assertEqual (called , [
189+ ('foo' , original_dbg_id ),
190+ ('bar' , original_dbg_id ),
191+ ])
195192
196193 def test_RemoveDestroyCallback (self ):
197194 original_dbg_id = self .dbg .GetID ()
@@ -200,12 +197,12 @@ def test_RemoveDestroyCallback(self):
200197 def foo (dbg_id ):
201198 # Need nonlocal to modify closure variable.
202199 nonlocal called
203- called += [(" foo" , dbg_id )]
200+ called += [(' foo' , dbg_id )]
204201
205202 def bar (dbg_id ):
206203 # Need nonlocal to modify closure variable.
207204 nonlocal called
208- called += [(" bar" , dbg_id )]
205+ called += [(' bar' , dbg_id )]
209206
210207 token_foo = self .dbg .AddDestroyCallback (foo )
211208 token_bar = self .dbg .AddDestroyCallback (bar )
@@ -215,7 +212,7 @@ def bar(dbg_id):
215212 # `Remove` should be successful
216213 self .assertTrue (ret )
217214 # Should only call `bar()`
218- self .assertEqual (called , [(" bar" , original_dbg_id )])
215+ self .assertEqual (called , [(' bar' , original_dbg_id )])
219216
220217 def test_RemoveDestroyCallback_invalid_token (self ):
221218 original_dbg_id = self .dbg .GetID ()
@@ -225,7 +222,7 @@ def test_RemoveDestroyCallback_invalid_token(self):
225222 def foo (dbg_id ):
226223 # Need nonlocal to modify closure variable.
227224 nonlocal called
228- called += [(" foo" , dbg_id )]
225+ called += [(' foo' , dbg_id )]
229226
230227 token_foo = self .dbg .AddDestroyCallback (foo )
231228 ret = self .dbg .RemoveDestroyCallback (magic_token_that_should_not_exist )
@@ -234,7 +231,7 @@ def foo(dbg_id):
234231 # `Remove` should be unsuccessful
235232 self .assertFalse (ret )
236233 # Should call `foo()`
237- self .assertEqual (called , [(" foo" , original_dbg_id )])
234+ self .assertEqual (called , [(' foo' , original_dbg_id )])
238235
239236 def test_HandleDestroyCallback (self ):
240237 """
@@ -249,52 +246,46 @@ def test_HandleDestroyCallback(self):
249246 def foo (dbg_id ):
250247 # Need nonlocal to modify closure variable.
251248 nonlocal events
252- events .append ((" foo called" , dbg_id ))
249+ events .append ((' foo called' , dbg_id ))
253250
254251 def bar (dbg_id ):
255252 # Need nonlocal to modify closure variable.
256253 nonlocal events
257- events .append ((" bar called" , dbg_id ))
254+ events .append ((' bar called' , dbg_id ))
258255
259256 def add_foo (dbg_id ):
260257 # Need nonlocal to modify closure variable.
261258 nonlocal events
262- events .append ((" add_foo called" , dbg_id ))
263- events .append ((" foo token" , self .dbg .AddDestroyCallback (foo )))
259+ events .append ((' add_foo called' , dbg_id ))
260+ events .append ((' foo token' , self .dbg .AddDestroyCallback (foo )))
264261
265262 def remove_bar (dbg_id ):
266263 # Need nonlocal to modify closure variable.
267264 nonlocal events
268- events .append ((" remove_bar called" , dbg_id ))
269- events .append ((" remove bar ret" , self .dbg .RemoveDestroyCallback (bar_token )))
265+ events .append ((' remove_bar called' , dbg_id ))
266+ events .append ((' remove bar ret' , self .dbg .RemoveDestroyCallback (bar_token )))
270267
271268 # Setup
272- events .append ((" add_foo token" , self .dbg .AddDestroyCallback (add_foo )))
269+ events .append ((' add_foo token' , self .dbg .AddDestroyCallback (add_foo )))
273270 bar_token = self .dbg .AddDestroyCallback (bar )
274- events .append ((" bar token" , bar_token ))
275- events .append ((" remove_bar token" , self .dbg .AddDestroyCallback (remove_bar )))
271+ events .append ((' bar token' , bar_token ))
272+ events .append ((' remove_bar token' , self .dbg .AddDestroyCallback (remove_bar )))
276273 # Destroy
277274 self .dbg .Destroy (self .dbg )
278275
279- self .assertEqual (
280- events ,
281- [
282- # Setup
283- ("add_foo token" , 0 ), # add_foo should be added
284- ("bar token" , 1 ), # bar should be added
285- ("remove_bar token" , 2 ), # remove_bar should be added
286- # Destroy
287- ("add_foo called" , original_dbg_id ), # add_foo should be called
288- ("foo token" , 3 ), # foo should be added
289- ("bar called" , original_dbg_id ), # bar should be called
290- ("remove_bar called" , original_dbg_id ), # remove_bar should be called
291- (
292- "remove bar ret" ,
293- False ,
294- ), # remove_bar should fail, because it's already invoked and removed
295- ("foo called" , original_dbg_id ), # foo should be called
296- ],
297- )
276+ self .assertEqual (events , [
277+ # Setup
278+ ('add_foo token' , 0 ), # add_foo should be added
279+ ('bar token' , 1 ), # bar should be added
280+ ('remove_bar token' , 2 ), # remove_bar should be added
281+ # Destroy
282+ ('add_foo called' , original_dbg_id ), # add_foo should be called
283+ ('foo token' , 3 ), # foo should be added
284+ ('bar called' , original_dbg_id ), # bar should be called
285+ ('remove_bar called' , original_dbg_id ), # remove_bar should be called
286+ ('remove bar ret' , False ), # remove_bar should fail, because it's already invoked and removed
287+ ('foo called' , original_dbg_id ), # foo should be called
288+ ])
298289
299290 def test_version (self ):
300291 instance_str = self .dbg .GetVersionString ()
0 commit comments