Package logilab :: Package common :: Package test :: Module unittest_ureports_html
[frames] | no frames]

Source Code for Module logilab.common.test.unittest_ureports_html

 1  '''unit tests for ureports.html_writer 
 2  ''' 
 3   
 4  __revision__ = "$Id: unittest_ureports_html.py,v 1.3 2005-05-27 12:27:08 syt Exp $" 
 5   
 6  from utils import WriterTC 
 7  from logilab.common.testlib import TestCase, unittest_main 
 8  from logilab.common.ureports.html_writer import * 
 9   
10 -class HTMLWriterTC(TestCase, WriterTC):
11
12 - def setUp(self):
13 self.writer = HTMLWriter(1)
14 15 # Section tests ########################################################### 16 section_base = '''<div> 17 <h1>Section title</h1> 18 <p>Section\'s description. 19 Blabla bla</p></div> 20 ''' 21 section_nested = '''<div>\n<h1>Section title</h1>\n<p>Section\'s description.\nBlabla bla</p><div>\n<h2>Subsection</h2>\n<p>Sub section description</p></div>\n</div>\n''' 22 23 # List tests ############################################################## 24 list_base = '''<ul>\n<li>item1</li>\n<li>item2</li>\n<li>item3</li>\n<li>item4</li>\n</ul>\n''' 25 26 nested_list = '''<ul> 27 <li><p>blabla<ul> 28 <li>1</li> 29 <li>2</li> 30 <li>3</li> 31 </ul> 32 </p></li> 33 <li>an other point</li> 34 </ul> 35 ''' 36 37 # Table tests ############################################################# 38 table_base = '''<table>\n<tr class="odd">\n<td>head1</td>\n<td>head2</td>\n</tr>\n<tr class="even">\n<td>cell1</td>\n<td>cell2</td>\n</tr>\n</table>\n''' 39 field_table = '''<table class="field" id="mytable">\n<tr class="odd">\n<td>f1</td>\n<td>v1</td>\n</tr>\n<tr class="even">\n<td>f22</td>\n<td>v22</td>\n</tr>\n<tr class="odd">\n<td>f333</td>\n<td>v333</td>\n</tr>\n</table>\n''' 40 advanced_table = '''<table class="whatever" id="mytable">\n<tr class="header">\n<th>field</th>\n<th>value</th>\n</tr>\n<tr class="even">\n<td>f1</td>\n<td>v1</td>\n</tr>\n<tr class="odd">\n<td>f22</td>\n<td>v22</td>\n</tr>\n<tr class="even">\n<td>f333</td>\n<td>v333</td>\n</tr>\n<tr class="odd">\n<td> <a href="http://www.perdu.com">toi perdu ?</a></td>\n<td>&nbsp;</td>\n</tr>\n</table>\n''' 41 42 43 # VerbatimText tests ###################################################### 44 verbatim_base = '''<pre>blablabla</pre>'''
45 46 if __name__ == '__main__': 47 unittest_main() 48