'When a file object is used instead of a numeric file descriptor,
the object should be closed (by IOLoop.close(all_fds=True),
not just the fd.'

def test_close_file_object(self):

    class SocketWrapper(object, ):
        def __init__(self, sockobj):
            self.sockobj = sockobj
            self.closed = False
        def fileno(self):
            return self.sockobj.fileno()
        def close(self):
            self.closed = True
            self.sockobj.close()
    (sockobj, port) = bind_unused_port()
    socket_wrapper = SocketWrapper(sockobj)
    io_loop = IOLoop()
    io_loop.add_handler(socket_wrapper, (lambda fd, events: None), IOLoop.READ)
    io_loop.close(all_fds=True)
    self.assertTrue(socket_wrapper.closed)
