[Checkins] SVN: zope3org/trunk/src/zorg/restsupport/ Added a test for html2rest

Uwe Oestermeier uwe_oestermeier at iwm-kmrc.de
Tue Mar 28 11:29:35 EST 2006


Log message for revision 66242:
  Added a test for html2rest

Changed:
  U   zope3org/trunk/src/zorg/restsupport/__init__.py
  U   zope3org/trunk/src/zorg/restsupport/tests.py

-=-
Modified: zope3org/trunk/src/zorg/restsupport/__init__.py
===================================================================
--- zope3org/trunk/src/zorg/restsupport/__init__.py	2006-03-27 13:52:17 UTC (rev 66241)
+++ zope3org/trunk/src/zorg/restsupport/__init__.py	2006-03-28 16:29:33 UTC (rev 66242)
@@ -70,8 +70,8 @@
     <BLANKLINE>
     
     """
-    
-    if fragment :
+        
+    if fragment and not '<html>' in html.lower() :
         html = "<html><body>%s</body></html>" % html
         
     if catch_errors :

Modified: zope3org/trunk/src/zorg/restsupport/tests.py
===================================================================
--- zope3org/trunk/src/zorg/restsupport/tests.py	2006-03-27 13:52:17 UTC (rev 66241)
+++ zope3org/trunk/src/zorg/restsupport/tests.py	2006-03-28 16:29:33 UTC (rev 66242)
@@ -46,6 +46,13 @@
 </html>
 """ % htmlFragment
     
+htmlList = """
+<html><body><p><i>Test</i> paragraph</p> 
+    <ul>
+    <li>1. Text</li>
+    <li>2. Text&nbsp;</li>
+    </ul>
+</body></html>"""
 
 def test_htmlTable2Rest() :
     """
@@ -72,8 +79,22 @@
 
     """
     
+def test_htmlList2Rest() :
+    """
+    
+    >>> from zorg.restsupport import html2rest
+    >>> print html2rest(htmlList, catch_errors=False)
+    *Test* paragraph
+    <BLANKLINE>
+    * 1. Text
+    <BLANKLINE>
+    * 2. TextÊ
+    <BLANKLINE>
 
 
+    """
+    
+
 def test_suite():
     return unittest.TestSuite((
         doctest.DocTestSuite(),



More information about the Checkins mailing list