def test_con_close(self): ac = ActiveConnections() app = tornado.web.Application() app.active_connections = ac r = MockRequest() wh = WSHandler(app, r) ac.connections.append(wh) wh.on_close() assert wh not in ac.connections