def test_init_failure_raises_connection_error(self):

        def raise_error(*args):
            raise socket.error

        assert socket.create_connection is self.MockCreateConn
        socket.create_connection.side_effect=raise_error
        with self.assertRaises(ConnectionError):
            KafkaConnection(self.config['host'], self.config['port'])
dataset/ETHPy150Open dpkp/kafka-python/test/test_conn_legacy.py/ConnTest.test_init_failure_raises_connection_error/original