prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Missing documentation about unit testing inline scripts
  At the company I work on we are developing some inline scripts to use internally.
  
  We are struggling to create test for our scripts because the only code we found to test scripts are the ones at [/mitmproxy/mitmproxy/blob/v0.17/test/mitmproxy/test_examples.py](/mitmproxy/mitmproxy/blob/v0.17/test/mitmproxy/test_examples.py).
  
  The examples are quite good but real documentation is missing for the ones who wants to unit test.
  
  Is there another place where I can find better (maybe more advanced) test examples ?
  
  
  </issue>
  <code>
  [start of mitmproxy/events.py]
  1 from mitmproxy import controller
  2 from mitmproxy import http
  3 from mitmproxy import tcp
  4 from mitmproxy import websocket
  5 
  6 Events = frozenset([
  7     "clientconnect",
  8     "clientdisconnect",
  9     "serverconnect",
  10     "serverdisconnect",
  11 
  12     "tcp_start",
  13     "tcp_message",
  14     "tcp_error",
  15     "tcp_end",
  16 
  17     "http_connect",
  18     "request",
  19     "requestheaders",
  20     "response",
  21     "responseheaders",
  22     "error",
  23 
  24     "intercept",
  25     "resume",
  26 
  27     "websocket_handshake",
  28     "websocket_start",
  29     "websocket_message",
  30     "websocket_error",
  31     "websocket_end",
  32 
  33     "next_layer",
  34 
  35     "configure",
  36     "done",
  37     "log",
  38     "start",
  39     "tick",
  40 ])
  41 
  42 
  43 def event_sequence(f):
  44     if isinstance(f, http.HTTPFlow):
  45         if f.request:
  46             yield "requestheaders", f
  47             yield "request", f
  48         if f.response:
  49             yield "responseheaders", f
  50             yield "response", f
  51         if f.error:
  52             yield "error", f
  53     elif isinstance(f, websocket.WebSocketFlow):
  54         messages = f.messages
  55         f.messages = []
  56         f.reply = controller.DummyReply()
  57         yield "websocket_start", f
  58         while messages:
  59             f.messages.append(messages.pop(0))
  60             yield "websocket_message", f
  61         if f.error:
  62             yield "websocket_error", f
  63         yield "websocket_end", f
  64     elif isinstance(f, tcp.TCPFlow):
  65         messages = f.messages
  66         f.messages = []
  67         f.reply = controller.DummyReply()
  68         yield "tcp_start", f
  69         while messages:
  70             f.messages.append(messages.pop(0))
  71             yield "tcp_message", f
  72         if f.error:
  73             yield "tcp_error", f
  74         yield "tcp_end", f
  75     else:
  76         raise NotImplementedError
  77
  [end of mitmproxy/events.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mitmproxy/events.py b/mitmproxy/events.py
  --- a/mitmproxy/events.py
  +++ b/mitmproxy/events.py
  @@ -21,9 +21,6 @@
       "responseheaders",
       "error",
   
  -    "intercept",
  -    "resume",
  -
       "websocket_handshake",
       "websocket_start",
       "websocket_message",
  
verification_info: {"golden_diff": "diff --git a/mitmproxy/events.py b/mitmproxy/events.py\n--- a/mitmproxy/events.py\n+++ b/mitmproxy/events.py\n@@ -21,9 +21,6 @@\n     \"responseheaders\",\n     \"error\",\n \n-    \"intercept\",\n-    \"resume\",\n-\n     \"websocket_handshake\",\n     \"websocket_start\",\n     \"websocket_message\",\n", "issue": "Missing documentation about unit testing inline scripts\nAt the company I work on we are developing some inline scripts to use internally.\n\nWe are struggling to create test for our scripts because the only code we found to test scripts are the ones at [/mitmproxy/mitmproxy/blob/v0.17/test/mitmproxy/test_examples.py](/mitmproxy/mitmproxy/blob/v0.17/test/mitmproxy/test_examples.py).\n\nThe examples are quite good but real documentation is missing for the ones who wants to unit test.\n\nIs there another place where I can find better (maybe more advanced) test examples ?\n\n", "before_files": [{"content": "from mitmproxy import controller\nfrom mitmproxy import http\nfrom mitmproxy import tcp\nfrom mitmproxy import websocket\n\nEvents = frozenset([\n    \"clientconnect\",\n    \"clientdisconnect\",\n    \"serverconnect\",\n    \"serverdisconnect\",\n\n    \"tcp_start\",\n    \"tcp_message\",\n    \"tcp_error\",\n    \"tcp_end\",\n\n    \"http_connect\",\n    \"request\",\n    \"requestheaders\",\n    \"response\",\n    \"responseheaders\",\n    \"error\",\n\n    \"intercept\",\n    \"resume\",\n\n    \"websocket_handshake\",\n    \"websocket_start\",\n    \"websocket_message\",\n    \"websocket_error\",\n    \"websocket_end\",\n\n    \"next_layer\",\n\n    \"configure\",\n    \"done\",\n    \"log\",\n    \"start\",\n    \"tick\",\n])\n\n\ndef event_sequence(f):\n    if isinstance(f, http.HTTPFlow):\n        if f.request:\n            yield \"requestheaders\", f\n            yield \"request\", f\n        if f.response:\n            yield \"responseheaders\", f\n            yield \"response\", f\n        if f.error:\n            yield \"error\", f\n    elif isinstance(f, websocket.WebSocketFlow):\n        messages = f.messages\n        f.messages = []\n        f.reply = controller.DummyReply()\n        yield \"websocket_start\", f\n        while messages:\n            f.messages.append(messages.pop(0))\n            yield \"websocket_message\", f\n        if f.error:\n            yield \"websocket_error\", f\n        yield \"websocket_end\", f\n    elif isinstance(f, tcp.TCPFlow):\n        messages = f.messages\n        f.messages = []\n        f.reply = controller.DummyReply()\n        yield \"tcp_start\", f\n        while messages:\n            f.messages.append(messages.pop(0))\n            yield \"tcp_message\", f\n        if f.error:\n            yield \"tcp_error\", f\n        yield \"tcp_end\", f\n    else:\n        raise NotImplementedError\n", "path": "mitmproxy/events.py"}]}