From f9bb4969af0b9cedeb837ac5260b03c011df9a7c Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Wed, 14 Feb 2001 06:35:35 +0000 Subject: [PATCH] Miranda newlines: if anything at all was written to stdout, supply a newline at the end if there isn't one already. Expected output has no way to indicate that a trailing newline was not expected, and in the interpreter shell *Python* supplies the trailing newline before printing the next prompt. --- Lib/doctest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/doctest.py b/Lib/doctest.py index b3ef98b879e..9c0ecc87a8b 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -444,7 +444,13 @@ def __init__(self): def write(self, s): self.buf.append(s) def get(self): - return "".join(self.buf) + guts = "".join(self.buf) + # If anything at all was written, make sure there's a trailing + # newline. There's no way for the expected output to indicate + # that a trailing newline is missing. + if guts and not guts.endswith("\n"): + guts = guts + "\n" + return guts def clear(self): self.buf = [] def flush(self):