summaryrefslogtreecommitdiff
path: root/test/DocutilsTestSupport.py
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-07-02 23:08:53 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-07-02 23:08:53 +0000
commitd04b3b06ae8404240bd8ab5cd22bebb34dfdb0f3 (patch)
treed05acd8795c15b04676abae3d5557d04b1fd5ca3 /test/DocutilsTestSupport.py
parent4c9becf2db37c07284913497627b7c7a574ce30e (diff)
downloaddocutils-d04b3b06ae8404240bd8ab5cd22bebb34dfdb0f3.tar.gz
revert docutils.writers.null.Writer.output to None, now with docutils.io.Output and test support
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3646 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/DocutilsTestSupport.py')
-rw-r--r--test/DocutilsTestSupport.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
index 72d5cdbc2..c0c2c331b 100644
--- a/test/DocutilsTestSupport.py
+++ b/test/DocutilsTestSupport.py
@@ -153,13 +153,19 @@ class CustomTestCase(StandardTestCase):
expected = expected.encode('raw_unicode_escape')
try:
self.assertEquals(output, expected)
- except AssertionError:
+ except AssertionError, error:
print >>sys.stderr, '\n%s\ninput:' % (self,)
print >>sys.stderr, input
- print >>sys.stderr, '-: expected\n+: output'
- print >>sys.stderr, ''.join(self.compare(expected.splitlines(1),
- output.splitlines(1)))
- raise
+ try:
+ comparison = ''.join(self.compare(expected.splitlines(1),
+ output.splitlines(1)))
+ print >>sys.stderr, '-: expected\n+: output'
+ print >>sys.stderr, comparison
+ except AttributeError: # expected or output not a string
+ # alternative output for non-strings:
+ print >>sys.stderr, 'expected: %r' % expected
+ print >>sys.stderr, 'output: %r' % output
+ raise error
def failUnlessEqual(self, first, second, msg=None):
"""Fail if the two objects are unequal as determined by the '=='
@@ -819,8 +825,8 @@ def _format_str(*args):
return_tuple = []
for i in args:
r = repr(i)
- if '\n' in i and (isinstance(i, StringType) or
- isinstance(i, UnicodeType)):
+ if ( (isinstance(i, StringType) or isinstance(i, UnicodeType))
+ and '\n' in i):
stripped = ''
if isinstance(i, UnicodeType):
# stripped = 'u' or 'U'