unittest BUG?
Robin Becker
robin at jessikat.fsnet.co.uk
Fri May 18 14:27:59 EDT 2001
We are using unittest.py $Revision: 1.3 $ and see extra ^Ms on win32. It seems the problem
comes from using the os.linesep in the following when the stream is stdout. Is there a sensible
way for this kind of class to obtain a sensible line terminator? Clearly the correct linesep for
files opened in text mode is '\n'.
class _WritelnDecorator:
"""Used to decorate file-like objects with a handy 'writeln' method"""
def __init__(self,stream):
self.stream = stream
if _isJPython:
import java.lang.System
self.linesep = java.lang.System.getProperty("line.separator")
else:
self.linesep = os.linesep
def __getattr__(self, attr):
return getattr(self.stream,attr)
def writeln(self, *args):
if args: apply(self.write, args)
self.write(self.linesep)
--
Robin Becker
More information about the Python-list
mailing list