Skip to content

Commit 83a1ecf

Browse files
committed
Fix format
In test_html the reformat was done by black
1 parent 80c1ea7 commit 83a1ecf

File tree

2 files changed

+20
-90
lines changed

2 files changed

+20
-90
lines changed

tests/test_html.py

Lines changed: 19 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -73,54 +73,18 @@ def test_browser_hack(self):
7373

7474
def test_missing_semicolon(self):
7575
for entity, result in (
76-
(
77-
"&lt&lt!",
78-
"<<!",
79-
),
80-
(
81-
"&LT!",
82-
"<!",
83-
),
84-
(
85-
"&#X41 ",
86-
"A ",
87-
),
88-
(
89-
"&#x41!",
90-
"A!",
91-
),
92-
(
93-
"&#x41h",
94-
"Ah",
95-
),
96-
(
97-
"&#65!",
98-
"A!",
99-
),
100-
(
101-
"&#65x",
102-
"Ax",
103-
),
104-
(
105-
"&sup3!",
106-
"\u00B3!",
107-
),
108-
(
109-
"&Aacute!",
110-
"\u00C1!",
111-
),
112-
(
113-
"&#9731!",
114-
"\u2603!",
115-
),
116-
(
117-
"&#153",
118-
"\u2122",
119-
),
120-
(
121-
"&#x99",
122-
"\u2122",
123-
),
76+
("&lt&lt!", "<<!"),
77+
("&LT!", "<!"),
78+
("&#X41 ", "A "),
79+
("&#x41!", "A!"),
80+
("&#x41h", "Ah"),
81+
("&#65!", "A!"),
82+
("&#65x", "Ax"),
83+
("&sup3!", "\u00B3!"),
84+
("&Aacute!", "\u00C1!"),
85+
("&#9731!", "\u2603!"),
86+
("&#153", "\u2122"),
87+
("&#x99", "\u2122"),
12488
):
12589
self.assertEqual(replace_entities(entity, encoding="cp1252"), result)
12690
self.assertEqual(
@@ -203,16 +167,7 @@ def test_returns_unicode(self):
203167
def test_remove_tags_without_tags(self):
204168
# text without tags
205169
self.assertEqual(remove_tags("no tags"), "no tags")
206-
self.assertEqual(
207-
remove_tags(
208-
"no tags",
209-
which_ones=(
210-
"p",
211-
"b",
212-
),
213-
),
214-
"no tags",
215-
)
170+
self.assertEqual(remove_tags("no tags", which_ones=("p", "b")), "no tags")
216171

217172
def test_remove_tags(self):
218173
# text with tags
@@ -294,14 +249,7 @@ def test_without_tags(self):
294249
# text without tags
295250
self.assertEqual(remove_tags_with_content("no tags"), "no tags")
296251
self.assertEqual(
297-
remove_tags_with_content(
298-
"no tags",
299-
which_ones=(
300-
"p",
301-
"b",
302-
),
303-
),
304-
"no tags",
252+
remove_tags_with_content("no tags", which_ones=("p", "b")), "no tags"
305253
)
306254

307255
def test_with_tags(self):
@@ -340,28 +288,10 @@ def test_returns_unicode(self):
340288
assert isinstance(replace_escape_chars(b"no ec"), str)
341289
assert isinstance(replace_escape_chars(b"no ec", replace_by="str"), str)
342290
assert isinstance(replace_escape_chars(b"no ec", replace_by="str"), str)
343-
assert isinstance(
344-
replace_escape_chars(
345-
b"no ec",
346-
which_ones=(
347-
"\n",
348-
"\t",
349-
),
350-
),
351-
str,
352-
)
291+
assert isinstance(replace_escape_chars(b"no ec", which_ones=("\n", "\t")), str)
353292
assert isinstance(replace_escape_chars("no ec"), str)
354293
assert isinstance(replace_escape_chars("no ec", replace_by="str"), str)
355-
assert isinstance(
356-
replace_escape_chars(
357-
"no ec",
358-
which_ones=(
359-
"\n",
360-
"\t",
361-
),
362-
),
363-
str,
364-
)
294+
assert isinstance(replace_escape_chars("no ec", which_ones=("\n", "\t")), str)
365295

366296
def test_without_escape_chars(self):
367297
# text without escape chars
@@ -671,12 +601,12 @@ def test_inside_script(self):
671601
)
672602

673603
def test_redirections_in_different_ordering__in_meta_tag(self):
674-
baseurl = 'http://localhost:8000'
604+
baseurl = "http://localhost:8000"
675605
url1 = '<html><head><meta http-equiv="refresh" content="0;url=dummy.html"></head></html>'
676606
url2 = '<html><head><meta content="0;url=dummy.html" http-equiv="refresh"></head></html>'
677607
self.assertEqual(
678-
get_meta_refresh(url1, baseurl), (0.0, 'http://localhost:8000/dummy.html')
608+
get_meta_refresh(url1, baseurl), (0.0, "http://localhost:8000/dummy.html")
679609
)
680610
self.assertEqual(
681-
get_meta_refresh(url2, baseurl), (0.0, 'http://localhost:8000/dummy.html')
611+
get_meta_refresh(url2, baseurl), (0.0, "http://localhost:8000/dummy.html")
682612
)

w3lib/html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
re.DOTALL | re.IGNORECASE,
2323
)
2424
_meta_refresh_re2 = re.compile(
25-
r'<meta\s[^>]*content\s*=\s*(?P<quote>["\'])(?P<int>(\d*\.)?\d+)\s*;\s*url=\s*(?P<url>.*?)(?P=quote)[^>]*?\shttp-equiv\s*=[^>]*refresh',
25+
r'<meta\s[^>]*content\s*=\s*(?P<quote>["\'])(?P<int>(\d*\.)?\d+)\s*;\s*url=\s*(?P<url>.*?)(?P=quote)[^>]*?\shttp-equiv\s*=[^>]*refresh',
2626
re.DOTALL | re.IGNORECASE,
2727
)
2828

0 commit comments

Comments
 (0)