I need to make changes in files so pylint pass pytest pass and pep8 pass
80 character long line STRICTLY
don't add any comments

server.py file:

import argparse
import socket
import threading
import queue
import json
import re
import logging
from collections import Counter
from urllib.parse import urlparse
from typing import List, Dict
import requests
from dataclasses import dataclass, field

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s - %(levelname)s - %(message)s"
)
logger = logging.getLogger(__name__)


@dataclass
class WorkerConfig:
    task_queue: queue.Queue
    result_queue: queue.Queue
    top_k: int
    total_counter: List[int]
    lock: threading.Lock


class Worker(threading.Thread):
    def __init__(self, config: WorkerConfig) -> None:
        super().__init__()
        self.task_queue = config.task_queue
        self.result_queue = config.result_queue
        self.top_k = config.top_k
        self.total_counter = config.total_counter
        self.lock = config.lock
        self.daemon = True

    def run(self) -> None:
        while True:
            client_socket, url = self.task_queue.get()
            try:
                words = self.fetch_and_parse(url)
                top_words = self.get_top_k(words)
                response = json.dumps(top_words)
                client_socket.sendall(response.encode("utf-8"))
            except (requests.RequestException, json.JSONDecodeError) as err:
                error_msg = json.dumps({"error": str(err)})
                try:
                    client_socket.sendall(error_msg.encode("utf-8"))
                except Exception as send_err:
                    logger.exception("Failed to send error message to client: %s", send_err)
            except Exception as err:
                error_msg = json.dumps({"error": "Internal server error"})
                try:
                    client_socket.sendall(error_msg.encode("utf-8"))
                except Exception as send_err:
                    logger.exception("Failed to send error message to client: %s", send_err)
                logger.exception("Unexpected error: %s", err)
            finally:
                client_socket.close()
                with self.lock:
                    self.total_counter[0] += 1
                    logger.info(
                        "Total URLs processed: %d",
                        self.total_counter[0]
                    )
                self.task_queue.task_done()

    def fetch_and_parse(self, url: str) -> List[str]:
        response = requests.get(url)
        response.raise_for_status()
        text = response.text.lower()
        words = re.findall(r"\b\w+\b", text)
        return words

    def get_top_k(self, words: List[str]) -> Dict[str, int]:
        counter = Counter(words)
        top = counter.most_common(self.top_k)
        return dict(top)


@dataclass
class ServerConfig:
    host: str = "0.0.0.0"
    port: int = 8000
    num_workers: int = 10
    top_k: int = 7


class MasterServer:
    def __init__(self, config: ServerConfig) -> None:
        self.host = config.host
        self.port = config.port
        self.num_workers = config.num_workers
        self.top_k = config.top_k
        self.task_queue: queue.Queue = queue.Queue()
        self.result_queue: queue.Queue = queue.Queue()
        self.total_counter = [0]
        self.lock = threading.Lock()
        self.workers: List[Worker] = []

    def start_workers(self) -> None:
        worker_config = WorkerConfig(
            task_queue=self.task_queue,
            result_queue=self.result_queue,
            top_k=self.top_k,
            total_counter=self.total_counter,
            lock=self.lock
        )
        for _ in range(self.num_workers):
            worker = Worker(worker_config)
            worker.start()
            self.workers.append(worker)

    def start_server(self) -> None:
        self.start_workers()
        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server_socket:
            server_socket.bind((self.host, self.port))
            server_socket.listen()
            logger.info("Server listening on %s:%d", self.host, self.port)
            while True:
                try:
                    client_socket, _ = server_socket.accept()
                    threading.Thread(
                        target=self.handle_client,
                        args=(client_socket,),
                        daemon=True
                    ).start()
                except Exception as accept_err:
                    logger.exception("Error accepting connections: %s", accept_err)

    def handle_client(self, client_socket: socket.socket) -> None:
        try:
            data = self.receive_data(client_socket)
            url = data.decode("utf-8").strip()
            if not url:
                raise ValueError("Empty URL received")
            parsed = urlparse(url)
            if not parsed.scheme:
                url = "http://" + url
            self.task_queue.put((client_socket, url))
        except (UnicodeDecodeError, ValueError) as err:
            error_msg = json.dumps({"error": str(err)})
            try:
                client_socket.sendall(error_msg.encode("utf-8"))
            except Exception as send_err:
                logger.exception("Failed to send error message to client: %s", send_err)
            finally:
                client_socket.close()
        except Exception as err:
            error_msg = json.dumps({"error": "Internal server error"})
            try:
                client_socket.sendall(error_msg.encode("utf-8"))
            except Exception as send_err:
                logger.exception("Failed to send error message to client: %s", send_err)
            finally:
                client_socket.close()
            logger.exception("Unexpected error in handle_client: %s", err)

    def receive_data(self, client_socket: socket.socket) -> bytes:
        buffer_size = 4096
        data = b""
        while True:
            part = client_socket.recv(buffer_size)
            if not part:
                break
            data += part
            if len(part) < buffer_size:
                break
        return data


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(description="Master-Worker HTTP Server")
    parser.add_argument(
        "-w", "--workers",
        type=int,
        default=10,
        help="Number of worker threads"
    )
    parser.add_argument(
        "-k", "--top_k",
        type=int,
        default=7,
        help="Top k frequent words"
    )
    parser.add_argument(
        "--host",
        type=str,
        default="0.0.0.0",
        help="Host to bind the server"
    )
    parser.add_argument(
        "--port",
        type=int,
        default=8000,
        help="Port to bind the server"
    )
    return parser.parse_args()


def main() -> None:
    args = parse_args()
    config = ServerConfig(
        host=args.host,
        port=args.port,
        num_workers=args.workers,
        top_k=args.top_k
    )
    server = MasterServer(config)
    try:
        server.start_server()
    except KeyboardInterrupt:
        logger.info("Server shutting down gracefully.")
    except Exception as err:
        logger.exception("Server encountered an unexpected error: %s", err)


if __name__ == "__main__":
    main()

client.py file:

import argparse
import threading
import socket
import json
import queue
import logging

logging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %(message)s')


class URLSender(threading.Thread):
    def __init__(self, task_queue, server_host, server_port, print_lock):
        super().__init__()
        self.task_queue = task_queue
        self.server_host = server_host
        self.server_port = server_port
        self.print_lock = print_lock
        self.daemon = True

    def run(self):
        while True:
            url = self.task_queue.get()
            if url is None:
                break
            response = self.send_url(url)
            with self.print_lock:
                print(f"{url}: {response}")
            self.task_queue.task_done()

    def send_url(self, url):
        try:
            with socket.create_connection(
                (self.server_host, self.server_port)
            ) as sock:
                sock.sendall(url.encode("utf-8"))
                response = self.receive_data(sock)
                return json.loads(response.decode("utf-8"))
        except (socket.error, json.JSONDecodeError) as e:
            logging.exception("Error sending URL: %s", url)
            return {"error": str(e)}

    def receive_data(self, sock):
        buff_size = 4096
        data = b""
        while True:
            part = sock.recv(buff_size)
            if not part:
                break
            data += part
            if len(part) < buff_size:
                break
        return data


class Client:
    def __init__(
        self, url_file, num_threads, server_host="127.0.0.1", server_port=8000
    ):
        self.url_file = url_file
        self.num_threads = num_threads
        self.server_host = server_host
        self.server_port = server_port
        self.task_queue = queue.Queue()
        self.print_lock = threading.Lock()
        self.threads = []

    def load_urls(self):
        try:
            with open(self.url_file, "r", encoding="utf-8") as f:
                for line in f:
                    url = line.strip()
                    if url:
                        self.task_queue.put(url)
        except FileNotFoundError:
            logging.error("URL file not found: %s", self.url_file)
            raise
        except IOError as e:
            logging.error("IO error when reading file %s: %s", self.url_file, e)
            raise

    def start_senders(self):
        for _ in range(self.num_threads):
            sender = URLSender(
                self.task_queue,
                self.server_host,
                self.server_port,
                self.print_lock,
            )
            sender.start()
            self.threads.append(sender)

    def run(self):
        self.load_urls()
        self.start_senders()
        self.task_queue.join()
        for _ in self.threads:
            self.task_queue.put(None)
        for thread in self.threads:
            thread.join()


def parse_args():
    parser = argparse.ArgumentParser(description="URL sender client")
    parser.add_argument(
        "num_threads", type=int, help="number of sender threads"
    )
    parser.add_argument("url_file", type=str, help="file containing URLs")
    parser.add_argument(
        "--host", type=str, default="127.0.0.1", help="server host"
    )
    parser.add_argument("--port", type=int, default=8000, help="server port")
    return parser.parse_args()


def main():
    args = parse_args()
    client = Client(args.url_file, args.num_threads, args.host, args.port)
    client.run()


if __name__ == "__main__":
    main()

test_file.py:

import json
import queue
import threading
import time
import unittest
from unittest.mock import patch, MagicMock, mock_open

import requests  # Importing requests to use specific exception classes

from server import Worker, WorkerConfig, MasterServer
from client import Client, URLSender


class TestWorker(unittest.TestCase):
    def setUp(self):
        self.task_queue = queue.Queue()
        self.result_queue = queue.Queue()
        self.top_k = 3
        self.total_counter = [0]
        self.lock = threading.Lock()

        # Create a WorkerConfig instance
        self.worker_config = WorkerConfig(
            task_queue=self.task_queue,
            result_queue=self.result_queue,
            top_k=self.top_k,
            total_counter=self.total_counter,
            lock=self.lock
        )

        # Instantiate Worker with the config
        self.worker = Worker(self.worker_config)
        self.worker.daemon = True
        self.worker.start()

    @patch("requests.get")
    def test_fetch_and_parse_normal(self, mock_get):
        mock_response = MagicMock()
        mock_response.text = "Data analysis is great. Data drives decisions."
        mock_response.raise_for_status = MagicMock()
        mock_get.return_value = mock_response

        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://analyticshub.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://analyticshub.com")
        expected = {"data": 2, "analysis": 1, "is": 1}
        client_socket.sendall.assert_called()
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        self.assertEqual(response, expected)
        self.assertEqual(self.total_counter[0], 1)

    @patch("requests.get")
    def test_fetch_and_parse_empty_response(self, mock_get):
        mock_response = MagicMock()
        mock_response.text = ""
        mock_response.raise_for_status = MagicMock()
        mock_get.return_value = mock_response

        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://emptycontent.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://emptycontent.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        self.assertEqual(response, {})
        self.assertEqual(self.total_counter[0], 1)

    @patch("requests.get",
           side_effect=requests.exceptions.HTTPError("503 Service Unavailable"))
    def test_fetch_and_parse_http_error(self, mock_get):
        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://downservice.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://downservice.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        self.assertIn("error", response)
        self.assertEqual(response["error"], "503 Service Unavailable")
        self.assertEqual(self.total_counter[0], 1)

    @patch("requests.get", side_effect=requests.exceptions.ConnectTimeout(
        "Connection timed out"))
    def test_fetch_and_parse_timeout(self, mock_get):
        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://slowresponse.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://slowresponse.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        self.assertIn("error", response)
        self.assertEqual(response["error"], "Connection timed out")
        self.assertEqual(self.total_counter[0], 1)

    @patch("requests.get")
    def test_fetch_and_parse_large_response(self, mock_get):
        large_text = "innovation " * 5000 + "technology"
        mock_response = MagicMock()
        mock_response.text = large_text
        mock_response.raise_for_status = MagicMock()
        mock_get.return_value = mock_response

        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://bigdata.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://bigdata.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        expected = {"innovation": 5000, "technology": 1}
        self.assertEqual(response, expected)
        self.assertEqual(self.total_counter[0], 1)

    @patch("requests.get")
    def test_fetch_and_parse_non_text_content(self, mock_get):
        mock_response = MagicMock()
        mock_response.text = ""
        mock_response.raise_for_status = MagicMock()
        mock_get.return_value = mock_response

        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://binarydata.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://binarydata.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        self.assertEqual(response, {})
        self.assertEqual(self.total_counter[0], 1)

    @patch("requests.get")
    def test_fetch_and_parse_special_chars(self, mock_get):
        mock_response = MagicMock()
        test_text = "Robust error-handling mechanisms ensure reliability."
        mock_response.text = test_text
        mock_response.raise_for_status = MagicMock()
        mock_get.return_value = mock_response

        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://robustsystems.com"))
        self.task_queue.join()

        mock_get.assert_called_with("http://robustsystems.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        expected = {"robust": 1, "error": 1, "handling": 1, "mechanisms": 1,
                    "ensure": 1, "reliability": 1}
        self.assertEqual(response, expected)
        self.assertEqual(self.total_counter[0], 1)


class TestClient(unittest.TestCase):
    @patch("builtins.print")
    def test_client_send_normal_urls(self, mock_print):
        test_urls = (
            "http://analyticshub.com\n"
            "http://datascience.ai\n"
            "invalid_url"
        )
        mock_socket = MagicMock()
        mock_responses = [
            json.dumps({"data": 2, "analysis": 1, "is": 1}).encode("utf-8"),
            json.dumps({"data": 3, "science": 2, "ai": 1}).encode("utf-8"),
            json.dumps({"error": "Invalid URL"}).encode("utf-8"),
            b""
        ]
        mock_socket.recv.side_effect = mock_responses

        with patch("builtins.open", mock_open(read_data=test_urls)), \
                patch("socket.create_connection") as mock_conn:
            mock_conn.return_value.__enter__.return_value = mock_socket
            client = Client("urls.txt", 2, "127.0.0.1", 8000)
            client.run()

            expected_outputs = [
                "http://analyticshub.com: {'data': 2, 'analysis': 1, 'is': 1}",
                "http://datascience.ai: {'data': 3, 'science': 2, 'ai': 1}",
                "invalid_url: {'error': 'Invalid URL'}"
            ]
            calls = [unittest.mock.call(output) for output in expected_outputs]
            mock_print.assert_has_calls(calls, any_order=True)
            self.assertEqual(mock_print.call_count, 3)

    def test_client_empty_url_file(self):
        with patch("builtins.open", mock_open(read_data="")), \
                patch("socket.create_connection") as mock_conn, \
                patch.object(URLSender, "send_url") as mock_send:
            client = Client("empty_urls.txt", 5, "127.0.0.1", 8000)
            client.run()
            mock_send.assert_not_called()

    def test_client_file_not_found(self):
        with patch("builtins.open", side_effect=FileNotFoundError):
            client = Client("nonexistent_urls.txt", 2, "127.0.0.1", 8000)
            with self.assertRaises(FileNotFoundError):
                client.run()


class TestIntegration(unittest.TestCase):
    def test_full_cycle(self):
        def create_mock_response(url):
            mock_resp = MagicMock()
            if "analyticshub.com" in url:
                text = "Data analysis drives insights. Data is crucial."
                mock_resp.text = text
            elif "datascience.ai" in url:
                text = "Machine learning and AI are transforming industries."
                mock_resp.text = text
            else:
                mock_resp.raise_for_status.side_effect = requests.exceptions.HTTPError(
                    "404 Not Found")
                return mock_resp
            mock_resp.raise_for_status = MagicMock()
            return mock_resp

        def run_server():
            server = MasterServer("127.0.0.1", 9000, 2, 5)
            server.start_server()

        test_urls = (
            "http://analyticshub.com\n"
            "http://datascience.ai\n"
            "http://unknown.ai"
        )

        with patch("requests.get") as mock_get, \
                patch("builtins.print") as mock_print, \
                patch("builtins.open", mock_open(read_data=test_urls)):
            mock_get.side_effect = create_mock_response
            server_thread = threading.Thread(target=run_server, daemon=True)
            server_thread.start()
            time.sleep(1)  # Allow server to start

            client = Client("urls.txt", 3, "127.0.0.1", 9000)
            client.run()

            expected_outputs = [
                "http://analyticshub.com: {'data': 2, 'analysis': 1, 'drives': 1, 'insights': 1, 'is': 1}",
                "http://datascience.ai: {'machine': 1, 'learning': 1, 'and': 1, 'ai': 1, 'are': 1}",
                "http://unknown.ai: {'error': '404 Not Found'}"
            ]
            calls = [unittest.mock.call(output) for output in expected_outputs]
            mock_print.assert_has_calls(calls, any_order=True)
            self.assertEqual(mock_print.call_count, 3)


if __name__ == "__main__":
    unittest.main()

============================= test session starts ==============================
collecting ... collected 11 items

test_file.py::TestWorker::test_fetch_and_parse_empty_response 
test_file.py::TestWorker::test_fetch_and_parse_http_error 
test_file.py::TestWorker::test_fetch_and_parse_large_response 
test_file.py::TestWorker::test_fetch_and_parse_non_text_content 
test_file.py::TestWorker::test_fetch_and_parse_normal 
test_file.py::TestWorker::test_fetch_and_parse_special_chars PASSED     [  9%]PASSED         [ 18%]PASSED     [ 27%]PASSED   [ 36%]PASSED             [ 45%]FAILED      [ 54%]
test_file.py:135 (TestWorker.test_fetch_and_parse_special_chars)
{'ensure': 1,
 'error': 1,
 'handling': 1,
 'mechanisms': 1,
 'reliability': 1,
 'robust': 1} != {'error': 1, 'handling': 1, 'robust': 1}

<Click to see difference>

self = <test_file.TestWorker testMethod=test_fetch_and_parse_special_chars>
mock_get = <MagicMock name='get' id='140641442175056'>

    @patch("requests.get")
    def test_fetch_and_parse_special_chars(self, mock_get):
        mock_response = MagicMock()
        test_text = "Robust error-handling mechanisms ensure reliability."
        mock_response.text = test_text
        mock_response.raise_for_status = MagicMock()
        mock_get.return_value = mock_response
    
        client_socket = MagicMock()
        self.task_queue.put((client_socket, "http://robustsystems.com"))
        self.task_queue.join()
    
        mock_get.assert_called_with("http://robustsystems.com")
        sent_data = client_socket.sendall.call_args[0][0]
        response = json.loads(sent_data.decode("utf-8"))
        expected = {"robust": 1, "error": 1, "handling": 1, "mechanisms": 1,
                    "ensure": 1, "reliability": 1}
>       self.assertEqual(response, expected)

test_file.py:153: AssertionError
PASSED            [ 63%]


test_file.py::TestWorker::test_fetch_and_parse_timeout 
test_file.py::TestClient::test_client_empty_url_file 
test_file.py::TestClient::test_client_file_not_found 
test_file.py::TestClient::test_client_send_normal_urls 
test_file.py::TestIntegration::test_full_cycle PASSED              [ 72%]PASSED              [ 81%]PASSED            [ 90%]FAILED                    [100%]
test_file.py:204 (TestIntegration.test_full_cycle)
self = <test_file.TestIntegration testMethod=test_full_cycle>

    def test_full_cycle(self):
        def create_mock_response(url):
            mock_resp = MagicMock()
            if "analyticshub.com" in url:
                text = "Data analysis drives insights. Data is crucial."
                mock_resp.text = text
            elif "datascience.ai" in url:
                text = "Machine learning and AI are transforming industries."
                mock_resp.text = text
            else:
                mock_resp.raise_for_status.side_effect = requests.exceptions.HTTPError(
                    "404 Not Found")
                return mock_resp
            mock_resp.raise_for_status = MagicMock()
            return mock_resp
    
        def run_server():
            server = MasterServer("127.0.0.1", 9000, 2, 5)
            server.start_server()
    
        test_urls = (
            "http://analyticshub.com\n"
            "http://datascience.ai\n"
            "http://unknown.ai"
        )
    
        with patch("requests.get") as mock_get, \
                patch("builtins.print") as mock_print, \
                patch("builtins.open", mock_open(read_data=test_urls)):
            mock_get.side_effect = create_mock_response
            server_thread = threading.Thread(target=run_server, daemon=True)
            server_thread.start()
            time.sleep(1)  # Allow server to start
    
            client = Client("urls.txt", 3, "127.0.0.1", 9000)
            client.run()
    
            expected_outputs = [
                "http://analyticshub.com: {'data': 2, 'analysis': 1, 'drives': 1, 'insights': 1, 'is': 1}",
                "http://datascience.ai: {'machine': 1, 'learning': 1, 'and': 1, 'ai': 1, 'are': 1}",
                "http://unknown.ai: {'error': '404 Not Found'}"
            ]
            calls = [unittest.mock.call(output) for output in expected_outputs]
>           mock_print.assert_has_calls(calls, any_order=True)

test_file.py:248: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='print' id='140641442598000'>
calls = [call("http://analyticshub.com: {'data': 2, 'analysis': 1, 'drives': 1, 'insights': 1, 'is': 1}"), call("http://datasc...i: {'machine': 1, 'learning': 1, 'and': 1, 'ai': 1, 'are': 1}"), call("http://unknown.ai: {'error': '404 Not Found'}")]
any_order = True

    def assert_has_calls(self, calls, any_order=False):
        """assert the mock has been called with the specified calls.
        The `mock_calls` list is checked for the calls.
    
        If `any_order` is False (the default) then the calls must be
        sequential. There can be extra calls before or after the
        specified calls.
    
        If `any_order` is True then the calls can be in any order, but
        they must all appear in `mock_calls`."""
        expected = [self._call_matcher(c) for c in calls]
        cause = next((e for e in expected if isinstance(e, Exception)), None)
        all_calls = _CallList(self._call_matcher(c) for c in self.mock_calls)
        if not any_order:
            if expected not in all_calls:
                if cause is None:
                    problem = 'Calls not found.'
                else:
                    problem = ('Error processing expected calls.\n'
                               'Errors: {}').format(
                                   [e if isinstance(e, Exception) else None
                                    for e in expected])
                raise AssertionError(
                    f'{problem}\n'
                    f'Expected: {_CallList(calls)}'
                    f'{self._calls_repr(prefix="Actual").rstrip(".")}'
                ) from cause
            return
    
        all_calls = list(all_calls)
    
        not_found = []
        for kall in expected:
            try:
                all_calls.remove(kall)
            except ValueError:
                not_found.append(kall)
        if not_found:
>           raise AssertionError(
                '%r does not contain all of %r in its call list, '
                'found %r instead' % (self._mock_name or 'mock',
                                      tuple(not_found), all_calls)
            ) from cause
E           AssertionError: 'print' does not contain all of (call("http://analyticshub.com: {'data': 2, 'analysis': 1, 'drives': 1, 'insights': 1, 'is': 1}"), call("http://datascience.ai: {'machine': 1, 'learning': 1, 'and': 1, 'ai': 1, 'are': 1}"), call("http://unknown.ai: {'error': '404 Not Found'}")) in its call list, found [call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a340a3a0>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a340a3a0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a340a3a0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a340a3a0>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a340a3a0>, end=''), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a340ae50>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a340ae50>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a340ae50>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a340ae50>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a340ae50>, end=''), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a340aee0>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a340aee0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a340aee0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a340aee0>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a340aee0>, end=''), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a3437040>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a3437040>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a3437040>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a3437040>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a3437040>, end=''), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a340af70>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a340af70>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a340af70>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a340af70>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a340af70>, end=''), call("http://datascience.ai: {'error': '[Errno 61] Connection refused'}"), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a34370d0>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a34370d0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a34370d0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a34370d0>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a34370d0>, end=''), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a3437160>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a3437160>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a3437160>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a3437160>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a3437160>, end=''), call("http://analyticshub.com: {'error': '[Errno 61] Connection refused'}"), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a34371f0>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a34371f0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a34371f0>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a34371f0>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a34371f0>, end=''), call('Traceback (most recent call last):\n', file=<_io.StringIO object at 0x7fe9a3437280>, end=''), call('  File "/Users/polinazosimova/deep_python_24b_polinchikkk/06/client.py", line 32, in send_url\n    with socket.create_connection(\n', file=<_io.StringIO object at 0x7fe9a3437280>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 843, in create_connection\n    raise err\n', file=<_io.StringIO object at 0x7fe9a3437280>, end=''), call('  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 831, in create_connection\n    sock.connect(sa)\n', file=<_io.StringIO object at 0x7fe9a3437280>, end=''), call('ConnectionRefusedError: [Errno 61] Connection refused\n', file=<_io.StringIO object at 0x7fe9a3437280>, end=''), call("http://unknown.ai: {'error': '[Errno 61] Connection refused'}")] instead

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/mock.py:960: AssertionError




==================== 2 failed, 9 passed, 1 warning in 1.65s ====================