Skip to content

Commit 9e37d2f

Browse files
committed
stop mutating test_html_response default parameter
1 parent 3acb183 commit 9e37d2f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: mechanize/_response.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,13 +432,13 @@ def test_response(data='test data',
432432
return make_response(data, headers, url, code, msg)
433433

434434

435+
_html_header = [("Content-type", "text/html")]
435436
def test_html_response(data='test data',
436437
headers=[],
437438
url=None,
438439
code=200,
439440
msg="OK"):
440-
headers += [("Content-type", "text/html")]
441-
return make_response(data, headers, url, code, msg)
441+
return make_response(data, headers + _html_header, url, code, msg)
442442

443443

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

Diff for: 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)