From 0aee4d0dec0b0293af4d102fb67b5cf71ed91d25 Mon Sep 17 00:00:00 2001 From: YOKOTA Hiroshi Date: Thu, 25 Sep 2025 19:01:17 +0900 Subject: [PATCH 1/6] ' with self.assertRaises(TypeError) as exc: # If this were the intended `("example.com",)` the expected # output would be '
' @@ -331,20 +331,20 @@ def test_host_whitelist_slash_type_confusion(self): def test_host_whitelist_valid(self): # Frame with valid hostname in src is allowed. - html = '
' expected = '
' cleaner = Cleaner(frames=False, host_whitelist=["example.com"]) self.assertEqual(expected, cleaner.clean_html(html)) def test_host_whitelist_invalid(self): - html = '
' expected = '
' cleaner = Cleaner(frames=False, host_whitelist=["example.com"]) self.assertEqual(expected, cleaner.clean_html(html)) def test_host_whitelist_sneaky_userinfo(self): # Regression test: Don't be fooled by hostname and colon in userinfo. - html = '
' expected = '
' cleaner = Cleaner(frames=False, host_whitelist=["example.com"]) self.assertEqual(expected, cleaner.clean_html(html)) From 7af4b5150e40d8d989ddb0bd2a5635af11f56302 Mon Sep 17 00:00:00 2001 From: YOKOTA Hiroshi Date: Mon, 29 Sep 2025 23:05:07 +0900 Subject: [PATCH 2/6] Restore original test code that works without closing tag --- tests/test_clean.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_clean.py b/tests/test_clean.py index cfc1171..64ad52d 100644 --- a/tests/test_clean.py +++ b/tests/test_clean.py @@ -321,7 +321,7 @@ def test_host_whitelist_slash_type_confusion(self): # creates a host_whitelist of the empty string; a malformed triple-slash # URL has an "empty host" according to urlsplit, and `"" in ""` passes. # So, don't allow user to accidentally pass a string for host_whitelist. - html = '
' + html = '