def check_title_match(expected_title, pa11y_results, logger):
if not pa11y_results:<EOL><INDENT>return<EOL><DEDENT>title_errs = [err for err in pa11y_results<EOL>if err["<STR_LIT>"].startswith("<STR_LIT>")]<EOL>for err in title_errs:<EOL><INDENT>title_elmt = html.fragment_fromstring(err["<STR_LIT>"])<EOL>elided_title = title_elmt.text.strip()<EOL>if elided_title.endswith("<STR_LIT>"):<EOL><INDENT>pa11y_title = elided_title[<NUM_LIT:0>:-<NUM_LIT:4>].strip()<EOL><DEDENT>else:<EOL><INDENT>pa11y_title = elided_title<EOL><DEDENT>if pa11y_title not in expected_title:<EOL><INDENT>msg = (<EOL>u'<STR_LIT>'<EOL>u'<STR_LIT>'<EOL>u'<STR_LIT>'<EOL>).format(<EOL>scrapy_title=expected_title, elided_title=elided_title,<EOL>)<EOL>logger.error(msg)<EOL><DEDENT><DEDENT>
Check if Scrapy reports any issue with the HTML <title> element.
If so, compare that <title> element to the title that we got in the
A11yItem. If they don't match, something is screwy, and pa11y isn't
parsing the page that we expect.