#NEWLINE# def test_html_entities( self ) : #NEWLINE# #INDENT# frame_html = '<p>test %s</p><p><a href="foo">%s</a></p>' #NEWLINE# for ( url , expected ) in self . data_pairs . items ( ) : #NEWLINE# #INDENT# esc_url = url . replace ( '&' , '&amp;' ) #NEWLINE# ( all_urls , extracted ) = extract_html ( ( frame_html % ( esc_url , esc_url ) ) , test_pr ) #NEWLINE# self . assertEqual ( all_urls , [ url ] ) #NEWLINE# if ( 'url' not in expected ) : #NEWLINE# #INDENT# expected [ 'url' ] = url #NEWLINE# #UNINDENT# if ( 'title' not in expected ) : #NEWLINE# #INDENT# expected [ 'title' ] = expected [ 'url' ] #NEWLINE# #UNINDENT# self . assertEqual ( extracted , { #NEWLINE# #INDENT# extracted : expected , #NEWLINE# #UNINDENT# } ) #NEWLINE# rendered = parse_html ( ( '<p>%s</p>' % esc_url ) , test_pr ) #NEWLINE# self . assertHTMLEqual ( rendered , ( '<p>%s</p>' % self . full_pairs [ url ] ) )