def test_io_socket_close(self): connection = FakeConnection() io = IO(connection.parameters) io.socket = Mock(name='socket', spec=socket.socket) io.close() self.assertIsNone(io.socket)