[Zope-Checkins] CVS: Zope/lib/python/StructuredText/tests - testStructuredText.py:1.1.46.2
Andreas Jung
andreas@zope.com
Thu, 18 Oct 2001 16:04:17 -0400
Update of /cvs-repository/Zope/lib/python/StructuredText/tests
In directory cvs.zope.org:/tmp/cvs-serv10644/tests
Modified Files:
Tag: Zope-2_4-branch
testStructuredText.py
Log Message:
-backport of new testsuite from trunk
-fixed handling of __literals__ with underlines
-handling wrong handling of underlines
=== Zope/lib/python/StructuredText/tests/testStructuredText.py 1.1.46.1 => 1.1.46.2 ===
from StructuredText.StructuredText import HTML
import sys, os, unittest, cStringIO
-execfile(os.path.join(sys.path[0],'framework.py'))
from OFS import ndiff
"""
@@ -189,13 +188,15 @@
try:
open('_tmpout','w').write(html)
- ndiff.fcompare(os.path.join(regressions,reg_fname),'_tmpout')
+ ndiff.fcompare(os.path.join(regressions,reg_fname),
+ '_tmpout')
os.unlink('_tmpout')
finally:
sys.stdout = oldStdout
raise AssertionError, \
- 'HTML regression test failed on %s\nDiff:\n%s\n' % (f,IO.getvalue())
+ 'HTML regression test failed on %s\nDiff:\n%s\n' % (f,
+ IO.getvalue())
class BasicTests(unittest.TestCase):
@@ -212,12 +213,34 @@
self._test("xx _this is html_ xx","xx <u>this is html</u> xx")
def testEmphasis(self):
- """underline"""
+ """ emphasis """
self._test("xx *this is html* xx","xx <em>this is html</em> xx")
def testStrong(self):
- """underline"""
- self._test("xx **this is html** xx","xx <strong>this is html</strong> xx")
+ """ strong """
+ self._test("xx **this is html** xx",
+ "xx <strong>this is html</strong> xx")
+ def testUnderlineThroughoutTags(self):
+ """Underlined text containing tags should not be transformed"""
+ self._test('<a href="index_html">index_html</a>',
+ '<a href="index_html">index_html</a>')
+
+
+ def testUnderscoresInLiteral(self):
+ """ underscores in literals shouldn't do unterlining """
+
+ self._test("this is '__a_literal__' eh",
+ "<code>__a_literal__</code>")
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite( StructuredTextTests ) )
+ suite.addTest( unittest.makeSuite( BasicTests ) )
+ return suite
+
+def main():
+ unittest.TextTestRunner().run(test_suite())
-framework()
+if __name__ == '__main__':
+ main()