fix tests

This commit is contained in:
Maximilian Hils 2016-05-28 19:31:43 -07:00
parent b70663f434
commit 85aa5da6e3
7 changed files with 8 additions and 8 deletions

View File

@ -76,7 +76,7 @@ class Headers(MultiDict):
For use with the "Set-Cookie" header, see :py:meth:`get_all`.
"""
def __init__(self, fields=None, **headers):
def __init__(self, fields=(), **headers):
"""
Args:
fields: (optional) list of ``(name, value)`` header byte tuples,

View File

@ -19,7 +19,7 @@ host_header_re = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$")
class RequestData(MessageData):
def __init__(self, first_line_format, method, scheme, host, port, path, http_version, headers=None, content=None,
def __init__(self, first_line_format, method, scheme, host, port, path, http_version, headers=(), content=None,
timestamp_start=None, timestamp_end=None):
if not isinstance(headers, Headers):
headers = Headers(headers)

View File

@ -11,7 +11,7 @@ from .. import utils
class ResponseData(MessageData):
def __init__(self, http_version, status_code, reason=None, headers=None, content=None,
def __init__(self, http_version, status_code, reason=None, headers=(), content=None,
timestamp_start=None, timestamp_end=None):
if not isinstance(headers, Headers):
headers = Headers(headers)

View File

@ -22,7 +22,7 @@ def python_equals(testdata, text):
req_get = lambda: netlib.tutils.treq(method='GET', content='', path=b"/path?a=foo&a=bar&b=baz")
req_post = lambda: netlib.tutils.treq(method='POST', headers=None)
req_post = lambda: netlib.tutils.treq(method='POST', headers=())
req_patch = lambda: netlib.tutils.treq(method='PATCH', path=b"/path?query=param")

View File

@ -460,7 +460,7 @@ class TestAssembleRequest(object):
b'',
b'/',
b"HTTP/2.0",
None,
(),
None,
))
assert len(bytes) == 1
@ -475,7 +475,7 @@ class TestAssembleRequest(object):
b'',
b'/',
b"HTTP/2.0",
None,
(),
None,
)
req.stream_id = 0x42

View File

@ -13,7 +13,7 @@ class TestRequestData(object):
with raises(ValueError):
treq(headers="foobar")
assert isinstance(treq(headers=None).headers, Headers)
assert isinstance(treq(headers=()).headers, Headers)
class TestRequestCore(object):

View File

@ -15,7 +15,7 @@ class TestResponseData(object):
with raises(ValueError):
tresp(headers="foobar")
assert isinstance(tresp(headers=None).headers, Headers)
assert isinstance(tresp(headers=()).headers, Headers)
class TestResponseCore(object):