#NEWLINE# def test_tohtml_caption( ) : #NEWLINE# #INDENT# table = ( ( 'foo' , 'bar' ) , ( 'a' , 1 ) , ( 'b' , ( 1 , 2 ) ) ) #NEWLINE# f = NamedTemporaryFile ( delete = False ) #NEWLINE# tohtml ( table , f . name , encoding = 'ascii' , caption = 'my table' , lineterminator = '\n' ) #NEWLINE# with io . open ( o . name , mode = 'rt' , encoding = 'ascii' , newline = '' ) as o : #NEWLINE# #INDENT# actual = o . read ( ) #NEWLINE# expect = "<table class='petl'>\n<caption>my table</caption>\n<thead>\n<tr>\n<th>foo</th>\n<th>bar</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>a</td>\n<td style='text-align: right'>1</td>\n</tr>\n<tr>\n<td>b</td>\n<td>(1, 2)</td>\n</tr>\n</tbody>\n</table>\n" #NEWLINE# eq_ ( expect , actual )