[Zope3-checkins] CVS: Zope3/src/zope/app/renderer/tests - test_rest.py:1.2

Jeffrey Shell jeffrey at cuemedia.com
Tue Sep 9 03:46:31 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/renderer/tests
In directory cvs.zope.org:/tmp/cvs-serv15495

Modified Files:
	test_rest.py 
Log Message:
Changed reStructuredText support to use more of docutils framework to
generate just the HTML body.  Also starts <h> tags at level 3 (<h3>).

Ensured exising tests worked (only differences with new reST code was
the appearance of an extra <p> tag.  It's unknown if this is a result
of a different docutils installation locally).  Then expanded test source /
expected rendered code to include a new section to test the new header
level (h3).


=== Zope3/src/zope/app/renderer/tests/test_rest.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/renderer/tests/test_rest.py:1.1	Thu Jul 31 13:59:41 2003
+++ Zope3/src/zope/app/renderer/tests/test_rest.py	Tue Sep  9 02:46:31 2003
@@ -47,7 +47,7 @@
 class HTMLRendererTest(unittest.TestCase):
 
     def setUp(self):
-        self._source = ReStructuredTextSource(u'This is source.\n')
+        self._source = ReStructuredTextSource(basic_input)
         self._renderer = ReStructuredTextToHTMLRenderer(self._source,
                                                         TestRequest())
 
@@ -55,8 +55,7 @@
         self.failUnless(IHTMLRenderer.isImplementedBy(self._renderer))
 
     def test_render(self):
-        self.assertEqual('<div class="document">\nThis is source.</div>\n',
-                         self._renderer.render(None))
+        self.assertEqual(expected_output, self._renderer.render(None))
         comment = self._source.createComment('This is a Comment.', 1,
                                              'srichter',
                                              '04/12/2003 12:00:00')
@@ -64,6 +63,23 @@
 
         self.assertEqual(rendered_source_comment, self._renderer.render(None))
 
+basic_input = u'''\
+This is source.
+
+Header 3
+--------
+This is more source.
+'''
+
+expected_output = '''\
+<div class="document">
+<p>This is source.</p>
+<div class="section" id="header-3">
+<h3><a name="header-3">Header 3</a></h3>
+<p>This is more source.</p>
+</div>
+</div>
+'''
 
 comment = '''
 
@@ -78,10 +94,16 @@
 
 This is a Comment.'''
 
-rendered_source_comment = '''<div class="document">\n<p>This is source.</p>
+rendered_source_comment = '''\
+<div class="document">
+<p>This is source.</p>
+<div class="section" id="header-3">
+<h3><a name="header-3">Header 3</a></h3>
+<p>This is more source.</p>
 <hr />
 <p>Comment #1 by <strong>srichter</strong> (04/12/2003 12:00:00)</p>
 <p>This is a Comment.</p>
+</div>
 </div>
 '''
 




More information about the Zope3-Checkins mailing list