forked from buildbot/buildbot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
translate expectations into the native newline style
- Loading branch information
Dustin J. Mitchell
committed
Jun 7, 2010
1 parent
b384d56
commit 4177240
Showing
2 changed files
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sys | ||
|
||
def nl(s): | ||
"""Convert the given string to the native newline format, assuming it is | ||
already in normal UNIX newline format (\n). Use this to create the | ||
appropriate expectation in a failUnlessEqual""" | ||
if not isinstance(s, basestring): | ||
return s | ||
if sys.platform.startswith('win'): | ||
return s.replace('\n', '\r\n') | ||
else: | ||
return s |