Skip to content

Commit a4df0af

Browse files
committed
Merge branch 'test_html_response-fix' of https://github.com/mohawk2/mechanize
2 parents 3acb183 + 9e37d2f commit a4df0af

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

mechanize/_response.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -425,20 +425,22 @@ def close(self):
425425

426426

427427
def test_response(data='test data',
428-
headers=[],
428+
headers=(),
429429
url=None,
430430
code=200,
431431
msg="OK"):
432-
return make_response(data, headers, url, code, msg)
432+
return make_response(data, list(headers), url, code, msg)
433+
434+
435+
_html_header = [("Content-type", "text/html")]
433436

434437

435438
def test_html_response(data='test data',
436-
headers=[],
439+
headers=(),
437440
url=None,
438441
code=200,
439442
msg="OK"):
440-
headers += [("Content-type", "text/html")]
441-
return make_response(data, headers, url, code, msg)
443+
return make_response(data, list(headers) + _html_header, url, code, msg)
442444

443445

444446
def make_response(data, headers, url=None, code=200, msg="OK"):

test/test_html.py

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ def test_title_parsing(self):
6767

6868
class MiscTests(TestCase):
6969

70+
def test_util_func(self):
71+
headers1 = str(test_html_response('').info())
72+
headers2 = str(test_html_response('').info())
73+
self.assertEqual(headers1, headers2)
74+
7075
def test_link_parsing(self):
7176

7277
def get_first_link_text(html):

0 commit comments

Comments
 (0)