Opened 8 years ago

Closed 4 years ago

#27906 closed Bug (fixed)

assertInHTML('<a/><b/>', '<a/><b/><c/>') fails

Reported by: Michal Petrucha Owned by: Jacob Walls
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Michal Petrucha)

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.

Change History (9)

comment:1 by Michal Petrucha, 8 years ago

Description: modified (diff)
Summary: assertContains('<a/><b/><c/>', '<a/><b/>', html=True) failsassertInHTML('<a/><b/>', '<a/><b/><c/>') fails

comment:2 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Jacob Walls, 4 years ago

Owner: changed from Michal Petrucha to Jacob Walls

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.

comment:4 by Jacob Walls, 4 years ago

Has patch: set

comment:5 by Matthias Kestenholz, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Carlton Gibson, 4 years ago

Needs tests: set
Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:7 by Jacob Walls, 4 years ago

Needs tests: unset
Patch needs improvement: unset

Addressed Carlton's review.

comment:8 by Carlton Gibson, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:9 by Carlton Gibson <carlton@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In e26a7a8:

Fixed #27906 -- Fixed test tools counting of HTML matches for subsets of elements.

Previously examples such as '<a/><b/>' would not match in '<a/><b/><c/>'.

Note: See TracTickets for help on using tickets.
Back to Top