#NEWLINE# def test_html_diff( self ) : #NEWLINE# #INDENT# f1a = ( ( patch914575_from1 + ( '123\n' * 10 ) ) * 3 ) #NEWLINE# t1a = ( ( patch914575_to1 + ( '123\n' * 10 ) ) * 3 ) #NEWLINE# f1b = ( ( '456\n' * 10 ) + f1a ) #NEWLINE# t1b = ( ( '456\n' * 10 ) + t1a ) #NEWLINE# f1a = f1a . splitlines ( ) #NEWLINE# t1a = t1a . splitlines ( ) #NEWLINE# f1b = f1b . splitlines ( ) #NEWLINE# t1b = t1b . splitlines ( ) #NEWLINE# f2 = patch914575_from2 . splitlines ( ) #NEWLINE# t2 = patch914575_to2 . splitlines ( ) #NEWLINE# f3 = patch914575_from3 #NEWLINE# t3 = patch914575_to3 #NEWLINE# i = difflib . HtmlDiff ( ) #NEWLINE# j = difflib . HtmlDiff ( tabsize = 2 ) #NEWLINE# k = difflib . HtmlDiff ( wrapcolumn = 14 ) #NEWLINE# full = i . make_file ( f1a , t1a , 'from' , 'to' , context = False , numlines = 5 ) #NEWLINE# tables = '\n' . join ( [ '<h2>Context (first diff within numlines=5(default))</h2>' , i . make_table ( f1a , t1a , 'from' , 'to' , context = True ) , '<h2>Context (first diff after numlines=5(default))</h2>' , i . make_table ( f1b , t1b , 'from' , 'to' , context = True ) , '<h2>Context (numlines=6)</h2>' , i . make_table ( f1a , t1a , 'from' , 'to' , context = True , numlines = 6 ) , '<h2>Context (numlines=0)</h2>' , i . make_table ( f1a , t1a , 'from' , 'to' , context = True , numlines = 0 ) , '<h2>Same Context</h2>' , i . make_table ( f1a , f1a , 'from' , 'to' , context = True ) , '<h2>Same Full</h2>' , i . make_table ( f1a , f1b , 'from' , 'to' , context = False ) , '<h2>Empty Context</h2>' , i . make_table ( [ ] , [ ] , 'from' , 'to' , context = True ) , '<h2>Empty Full</h2>' , i . make_table ( [ ] , [ ] , 'from' , 'to' , context = False ) , '<h2>tabsize=2</h2>' , j . make_table ( f2 , t2 ) , '<h2>tabsize=default</h2>' , i . make_table ( f2 , t2 ) , '<h2>Context (wrapcolumn=14,numlines=0)</h2>' , k . make_table ( f3 . splitlines ( ) , t3 . splitlines ( ) , context = True , numlines = 0 ) , '<h2>wrapcolumn=14,splitlines()</h2>' , k . make_table ( f3 . splitlines ( ) , t3 . splitlines ( ) ) , '<h2>wrapcolumn=14,splitlines(True)</h2>' , k . make_table ( f3 . splitlines ( True ) , t3 . splitlines ( True ) ) ] ) #NEWLINE# actual = full . replace ( '</body>' , ( '\n%s\n</body>' % tables ) ) #NEWLINE# with open ( findfile ( 'test_difflib_expect.html' ) ) as fp : #NEWLINE# #INDENT# self . assertEqual ( actual , fp . read ( ) )