summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_html.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-08 12:27:04 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-08 19:25:02 +0100
commit3278c31fa59b41d03aea167f4cf85f4ddf7f848d (patch)
tree0c80b4868391296335580242c8e65052a4f62a6b /tests/utils_tests/test_html.py
parent6a682b38e75d4c975b4c4493565a59f1bc14397c (diff)
[4.0.x] Refs #33476 -- Refactored code to strictly match 88 characters line length.
Backport of 7119f40c9881666b6f9b5cf7df09ee1d21cc8344 from main.
Diffstat (limited to 'tests/utils_tests/test_html.py')
-rw-r--r--tests/utils_tests/test_html.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index f761ba84f2..81e2e8944b 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -183,24 +183,28 @@ class TestUtilsHtml(SimpleTestCase):
(
(
"&<>",
- '<script id="test_id" type="application/json">"\\u0026\\u003C\\u003E"</script>',
+ '<script id="test_id" type="application/json">'
+ '"\\u0026\\u003C\\u003E"</script>',
)
),
# "<", ">" and "&" are quoted inside JSON objects
(
{"a": "<script>test&ing</script>"},
'<script id="test_id" type="application/json">'
- '{"a": "\\u003Cscript\\u003Etest\\u0026ing\\u003C/script\\u003E"}</script>',
+ '{"a": "\\u003Cscript\\u003Etest\\u0026ing\\u003C/script\\u003E"}'
+ "</script>",
),
# Lazy strings are quoted
(
lazystr("&<>"),
- '<script id="test_id" type="application/json">"\\u0026\\u003C\\u003E"</script>',
+ '<script id="test_id" type="application/json">"\\u0026\\u003C\\u003E"'
+ "</script>",
),
(
{"a": lazystr("<script>test&ing</script>")},
'<script id="test_id" type="application/json">'
- '{"a": "\\u003Cscript\\u003Etest\\u0026ing\\u003C/script\\u003E"}</script>',
+ '{"a": "\\u003Cscript\\u003Etest\\u0026ing\\u003C/script\\u003E"}'
+ "</script>",
),
)
for arg, expected in tests:
@@ -222,11 +226,14 @@ class TestUtilsHtml(SimpleTestCase):
("http://example.com/?x=<>\"'", "http://example.com/?x=%3C%3E%22%27"),
(
"http://example.com/?q=http://example.com/?x=1%26q=django",
- "http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango",
+ "http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3D"
+ "django",
),
(
- "http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango",
- "http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango",
+ "http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3D"
+ "django",
+ "http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3D"
+ "django",
),
("http://.www.f oo.bar/", "http://.www.f%20oo.bar/"),
)
@@ -291,11 +298,13 @@ class TestUtilsHtml(SimpleTestCase):
tests = (
(
"Search for google.com/?q=! and see.",
- 'Search for <a href="http://google.com/?q=">google.com/?q=</a>! and see.',
+ 'Search for <a href="http://google.com/?q=">google.com/?q=</a>! and '
+ "see.",
),
(
"Search for google.com/?q=1&lt! and see.",
- 'Search for <a href="http://google.com/?q=1%3C">google.com/?q=1&lt</a>! and see.',
+ 'Search for <a href="http://google.com/?q=1%3C">google.com/?q=1&lt'
+ "</a>! and see.",
),
(
lazystr("Search for google.com/?q=!"),