Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.7k
Fixed #36499 -- Adjusted utils_tests.test_html.TestUtilsHtml.test_strip_tags following Python's HTMLParser new behavior.#19639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Uh oh!
There was an error while loading.Please reload this page.
There isone more failure in |
Yeah, I started fixing this test yesterday, and I've been trying to think what the right fix is, because is not straightforward. Before, this line: self.assertHTMLEqual("< div></ div>","<div></div>") would raise an AssertionError with message:
Now it fails with:
I need to dig deeper to understand if the assertion message change is acceptable or not. |
…ip_tags following Python's HTMLParser new behavior.
"('Unexpected end tag `div` (Line 1, Column6)', (1,6))" | ||
"('Unexpected end tag `div` (Line 1, Column0)', (1,0))" | ||
) | ||
with self.assertRaisesMessage(AssertionError, error_msg): | ||
self.assertHTMLEqual("< div></div>", "<div></div>") | ||
self.assertHTMLEqual("</div>", "<div></div>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Since this is not aboutstrip_tags()
, I think the commit message needs to be adjusted to show this. Also, maybe it doesn't really matter, or may allow the changes here to be split into 2 commits, but the changes toHTMLParser
resulting in this test failure areunrelated to those causing failures instrip_tags()
's tests.
Additionally, I think we can change to:
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.pyindex 494a0ea8d3..f2cfc55e2b 100644--- a/tests/test_utils/tests.py+++ b/tests/test_utils/tests.py@@ -962,7 +962,7 @@ class HTMLEqualTests(SimpleTestCase): "('Unexpected end tag `div` (Line 1, Column 6)', (1, 6))" ) with self.assertRaisesMessage(AssertionError, error_msg):- self.assertHTMLEqual("< div></ div>", "<div></div>")+ self.assertHTMLEqual("< div></div>", "<div></div>") with self.assertRaises(HTMLParseError): parse_html("</p>")
with the advantage of a (marginally 🌞) smaller diff and a test for a non-zero column position in the message
Uh oh!
There was an error while loading.Please reload this page.
🛑 Not to be merged before 3.13.6, 3.12.12, 3.11.14, 3.10.19 and 3.9.24 are released (and Jenkins CI gets updated).
Trac ticket number
ticket-36499
Branch description
As described in the ticket,Python's HTMLParser was adjusted to avoid poor performance on malformed HTML. This branch adjust the Django tests that were specifically added for performance related reports to follow Python's HTMLParser behavior.
Checklist
main
branch.