Skip to content

Декоратор "ignore_errors" для класса "UnityProxy" и тесты - #2

Open
cardisnotvalid wants to merge 2 commits into
mrsmori:mainfrom
cardisnotvalid:feat_ignore_errors
Open

Декоратор "ignore_errors" для класса "UnityProxy" и тесты#2
cardisnotvalid wants to merge 2 commits into
mrsmori:mainfrom
cardisnotvalid:feat_ignore_errors

Conversation

@cardisnotvalid

Copy link
Copy Markdown

Добавил декоратор "ignore_errors" внутри класса "UnityProxy", который игнорирует ошибки при парсинге прокси, по параметру класса "ignore_parse_errors".

И добавил для него тесты в файле "test_unity_proxy_class.py'.

@mrsmori mrsmori added the good first issue Good for newcomers label Sep 25, 2024
with pytest.raises(exceptions.CanNotParseProxy):
unity.add_by_line(created_line, "socks5")

assert (len(unity._UnityProxy__proxies) == 0)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len(unity) вернёт кол-во прокси. Не нужно лезть в приватные атрибуты) На то они и приватные

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def __len__(self) -> int:
        return len(self.__proxies)

unity = UnityProxy(ignore_parse_errors=True)
unity.add_by_line(created_line, "socks5")

assert (len(unity._UnityProxy__proxies) == 0)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже самое

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants