Lines Matching +refs:event +refs:hook

40     def __call__(self, event, args):  argument
43 self.seen.append((event, args))
44 if event in self.raise_on_events:
45 raise self.exc_type("saw event " + event)
83 with TestHook() as hook:
85 assertEqual(hook.seen[0][0], "test_event")
86 assertEqual(hook.seen[0][1], (1, 2, 3))
115 with TestHook() as hook:
126 actual = [(a[0], a[1]) for e, a in hook.seen if e == "marshal.dumps"]
129 actual = [a[0] for e, a in hook.seen if e == "marshal.loads"]
132 actual = [e for e, a in hook.seen if e == "marshal.load"]
149 with TestHook(raise_on_events="pickle.find_class") as hook:
169 with TestHook() as hook:
183 actual = [(a[0], a[1]) for e, a in hook.seen if e == "object.__setattr__"]
200 with TestHook(raise_on_events={"open"}) as hook:
213 actual_mode = [(a[0], a[1]) for e, a in hook.seen if e == "open" and a[1]]
214 actual_flag = [(a[0], a[2]) for e, a in hook.seen if e == "open" and not a[1]]
235 def trace(frame, event, *args): argument
237 traced.append(event)
241 with TestHook() as hook:
246 hook.__cantrace__ = False
250 hook.__cantrace__ = True
254 hook.__cantrace__ = 1
258 hook.__cantrace__ = 0
268 with TestHook() as hook:
270 assertEqual(hook.seen[0][1][:2], (-1, 8))
278 def hook(event, args): function
279 if event == "sys.excepthook":
284 print(event, repr(args[2]))
286 sys.addaudithook(hook)
297 def hook(event, args): function
298 if event == "sys.unraisablehook":
301 print(event, repr(args[1].exc_value), args[1].err_msg)
303 sys.addaudithook(hook)
311 def hook(event, args): function
312 if not event.startswith("winreg."):
314 print(event, *args)
316 sys.addaudithook(hook)
334 def hook(event, args): function
335 if event.startswith("socket."):
336 print(event, *args)
338 sys.addaudithook(hook)
356 def hook(event, args): function
357 if event.startswith("gc."):
358 print(event, *args)
360 sys.addaudithook(hook)
374 def hook(event, args): function
375 if event.startswith("http.client."):
376 print(event, *args[1:])
378 sys.addaudithook(hook)
392 def hook(event, *args): function
393 if event.startswith("sqlite3."):
394 print(event, *args)
396 sys.addaudithook(hook)