Pick off some easy coverage wins around raise statements
MODIFY
test/contrib/test_socks.py
test/contrib/test_socks.py
@@ -194,6 +194,14 @@ def handle_socks4_negotiation(sock, username=None):
yield True # Avoid StopIteration exceptions getting fired.
+class TestSOCKSProxyManager(object):
+
+ def test_invalid_socks_version_is_valueerror(self):
+ with pytest.raises(ValueError) as e:
+ socks.SOCKSProxyManager(proxy_url='http://example.org')
+ assert 'Unable to determine SOCKS version' in e.value.args[0]
+
+
class TestSocks5Proxy(IPV4SocketDummyServerTestCase):
"""
Test the SOCKS proxy in SOCKS5 mode.

MODIFY
test/test_collections.py
test/test_collections.py
@@ -239,6 +239,15 @@ class TestHTTPHeaderDict(object):
assert d['e'] == 'foofoo'
assert len(d) == 2
+ @pytest.mark.parametrize('args', [
+ (1, 2),
+ (1, 2, 3, 4, 5),
+ ])
+ def test_extend_with_wrong_number_of_args_is_typeerror(self, d, args):
+ with pytest.raises(TypeError) as err:
+ d.extend(*args)
+ assert 'extend() takes at most 1 positional arguments' in err.value.args[0]
+
def test_copy(self, d):
h = d.copy()
assert d is not h

MODIFY
test/test_util.py
test/test_util.py
@@ -11,6 +11,7 @@ import pytest
from urllib3 import add_stderr_logger, disable_warnings
from urllib3.util.request import make_headers, rewind_body, _FAILEDTELL
+from urllib3.util.response import assert_header_parsing
from urllib3.util.retry import Retry
from urllib3.util.timeout import Timeout
from urllib3.util.url import (
@@ -565,3 +566,12 @@ class TestUtil(object):
def test_parse_retry_after(self, value, expected):
retry = Retry()
assert retry.parse_retry_after(value) == expected
+
+ @pytest.mark.parametrize('headers', [
+ b'foo',
+ None,
+ object,
+ ])
+ def test_assert_header_parsing_throws_typeerror_with_non_headers(self, headers):
+ with pytest.raises(TypeError):
+ assert_header_parsing(headers)

Pick off some easy coverage wins around raise statements