Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nessita
Copy link
Contributor

@nessita nessita commented Jul 14, 2025

🛑 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

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.

@nessita nessita marked this pull request as draft July 14, 2025 17:53
@felixxm
Copy link
Member

felixxm commented Jul 15, 2025

There is one more failure in test_utils.tests.HTMLEqualTests.test_parsing_errors, it may be caused by the same change in HTMLParser.

@nessita
Copy link
Contributor Author

nessita commented Jul 15, 2025

There is one more failure in test_utils.tests.HTMLEqualTests.test_parsing_errors, it may be caused by the same change in HTMLParser.

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:

AssertionError: First argument is not valid HTML:
('Unexpected end tag `div` (Line 1, Column 6)', (1, 6))

Now it fails with:

AssertionError: &lt; div&gt; != <div>
- &lt; div&gt;
+ <div>

I need to dig deeper to understand if the assertion message change is acceptable or not.

@nessita nessita requested a review from cliff688 July 16, 2025 14:41
@nessita nessita force-pushed the ticket-36499 branch 2 times, most recently from be4c92c to 9cb945b Compare July 21, 2025 18:28
Copy link
Member

@cliff688 cliff688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🌟!
Small typo proessing -> processing in 2nd commit msg

nessita added 2 commits July 22, 2025 12:02
…ython's HTMLParser fixed parsing.

Further details about Python changes can be found in:
python/cpython@0243f97.

Thank you Clifford Gama for the thorough review!
…ip_tags following Python's HTMLParser new behavior.

Python fixed a quadratic complexity processing for HTMLParser in:
python/cpython@6eb6c5d.
@nessita
Copy link
Contributor Author

nessita commented Jul 22, 2025

Thank you 🌟! Small typo proessing -> processing in 2nd commit msg

Thank you, I fixed the commit 🎯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants