[Django] #27906: assertContains('<a/><b/><c/>', '<a/><b/>', html=True) fails

47 views
Skip to first unread message

Django

unread,
Mar 7, 2017, 5:49:17 AM3/7/17
to django-...@googlegroups.com
#27906: assertContains('<a/><b/><c/>', '<a/><b/>', html=True) fails
-------------------------------------+-------------------------------------
Reporter: Michal | Owner: Michal Petrucha
Petrucha |
Type: Bug | Status: assigned
Component: Testing | Version: master
framework |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
As the title indicates, `assertContains` in HTML mode fails to find
matches in the haystack if the needle consists of multiple sibling
elements that do appear in the haystack with more siblings on the same
level.

This is a follow-up to #24112, which fixed the simple case when the list
of children of an element matches exactly the list of children of the
needle.

A simple, but somewhat sub-optimal solution could be to use two nested
loops to compare the children of `self` with the children of the root
element; an optimal, but much more complex solution would be to implement
a variant of KMP on the children of `self`.

--
Ticket URL: <https://code.djangoproject.com/ticket/27906>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 7, 2017, 5:53:36 AM3/7/17
to django-...@googlegroups.com
#27906: assertInHTML('<a/><b/>', '<a/><b/><c/>') fails
-------------------------------------+-------------------------------------
Reporter: Michal Petrucha | Owner: Michal

| Petrucha
Type: Bug | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Michal Petrucha:

Old description:

> As the title indicates, `assertContains` in HTML mode fails to find
> matches in the haystack if the needle consists of multiple sibling
> elements that do appear in the haystack with more siblings on the same
> level.
>
> This is a follow-up to #24112, which fixed the simple case when the list
> of children of an element matches exactly the list of children of the
> needle.
>
> A simple, but somewhat sub-optimal solution could be to use two nested
> loops to compare the children of `self` with the children of the root
> element; an optimal, but much more complex solution would be to implement
> a variant of KMP on the children of `self`.

New description:

As the title indicates, HTML substring search fails to find matches in the


haystack if the needle consists of multiple sibling elements that do
appear in the haystack with more siblings on the same level.

This is a follow-up to #24112, which fixed the simple case when the list
of children of an element matches exactly the list of children of the
needle.

A simple, but somewhat sub-optimal solution could be to use two nested
loops to compare the children of `self` with the children of the root
element; an optimal, but much more complex solution would be to implement
a variant of KMP on the children of `self`.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27906#comment:1>

Django

unread,
Mar 7, 2017, 1:29:19 PM3/7/17
to django-...@googlegroups.com
#27906: assertInHTML('<a/><b/>', '<a/><b/><c/>') fails
-------------------------------------+-------------------------------------
Reporter: Michal Petrucha | Owner: Michal
| Petrucha
Type: Bug | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/27906#comment:2>

Django

unread,
Sep 19, 2020, 7:01:02 PM9/19/20
to django-...@googlegroups.com
#27906: assertInHTML('<a/><b/>', '<a/><b/><c/>') fails
-----------------------------------+---------------------------------------
Reporter: Michal Petrucha | Owner: Jacob Walls
Type: Bug | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by Jacob Walls):

* owner: Michal Petrucha => Jacob Walls


Comment:

We already have one loop so, yes, the simpler approach is to simply
introduce an inner loop to handle this case. I have something working that
I will proofread and submit sometime this week.

--
Ticket URL: <https://code.djangoproject.com/ticket/27906#comment:3>

Django

unread,
Sep 20, 2020, 3:12:13 PM9/20/20
to django-...@googlegroups.com
#27906: assertInHTML('<a/><b/>', '<a/><b/><c/>') fails
-------------------------------------+-------------------------------------

Reporter: Michal Petrucha | Owner: Jacob
| Walls
Type: Bug | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Matthias Kestenholz):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/27906#comment:5>

Django

unread,
Sep 24, 2020, 5:44:07 AM9/24/20
to django-...@googlegroups.com
#27906: assertInHTML('<a/><b/>', '<a/><b/><c/>') fails
-------------------------------------+-------------------------------------
Reporter: Michal Petrucha | Owner: Jacob
| Walls
Type: Bug | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/27906#comment:8>

Reply all
Reply to author
Forward
0 new messages