pha/matchers.py
def linear_match(spec, html_src):
    """ Flattens the html and the spec, and check all spec elements appear in order. """

    root_element = BeautifulSoup(html_src)
    all_element_definitions = _flatten_element_definitions(spec)
    _prune_unmatched_elements(root_element, all_element_definitions)

    element_def_index = 0
    current_element_def = None
    for element in _descendant_elements(root_element):
        current_element_def = all_element_definitions[element_def_index]
        if _matches(current_element_def, element):
            element_def_index += 1
            if element_def_index == len(all_element_definitions):
                return MatcherResult(spec, html_src, root_element, passed=True)

    # We didn't match everything. We report the matcher we failed on, and also check generally for matchers which
    # do not match a single element
    element_defs_not_found = []
    for element_def in all_element_definitions:
        if not any(element for element in _descendant_elements(root_element) if _matches(element_def, element)):
            element_defs_not_found.append(element_def)

    return MatcherResult(spec,
                         html_src,
                         root_element,
                         passed=False,
                         element_defs_not_found=element_defs_not_found,
                         failed_on_def=current_element_def)
 Flattens the html and the spec, and check all spec elements appear in order. 
Flattens the html and the spec, and check all spec elements appear in order.
Flattens the html and the spec and check all spec elements appear in order .
def linear_match(spec, html_src):
    root_element = BeautifulSoup(html_src)
    all_element_definitions = _flatten_element_definitions(spec)
    _prune_unmatched_elements(root_element, all_element_definitions)
    element_def_index = 0
    current_element_def = None
    for element in _descendant_elements(root_element):
        current_element_def = all_element_definitions[element_def_index]
        if _matches(current_element_def, element):
            element_def_index += 1
            if element_def_index == len(all_element_definitions):
                return MatcherResult(spec, html_src, root_element, passed=True)
    element_defs_not_found = []
    for element_def in all_element_definitions:
        if not any(element for element in _descendant_elements(root_element) if _matches(element_def, element)):
            element_defs_not_found.append(element_def)
    return MatcherResult(spec,
                         html_src,
                         root_element,
                         passed=False,
                         element_defs_not_found=element_defs_not_found,
                         failed_on_def=current_element_def)
def linear_match ( spec , html_src ) : root_element = BeautifulSoup ( html_src ) all_element_definitions = _flatten_element_definitions ( spec ) _prune_unmatched_elements ( root_element , all_element_definitions ) element_def_index = 0 current_element_def = None for element in _descendant_elements ( root_element ) : current_element_def = all_element_definitions [ element_def_index ] if _matches ( current_element_def , element ) : element_def_index += 1 if element_def_index == len ( all_element_definitions ) : return MatcherResult ( spec , html_src , root_element , passed = True ) element_defs_not_found = [ ] for element_def in all_element_definitions : if not any ( element for element in _descendant_elements ( root_element ) if _matches ( element_def , element ) ) : element_defs_not_found . append ( element_def ) return MatcherResult ( spec , html_src , root_element , passed = False , element_defs_not_found = element_defs_not_found , failed_on_def = current_element_def )
Flattens the html and the spec, and check all spec elements appear in order.
Flattens the html and the spec and check all spec elements appear in order .
""" Flattens the html and the spec, and check all spec elements appear in order. """ # We didn't match everything. We report the matcher we failed on, and also check generally for matchers which # do not match a single element
spec
html_src