Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9bb496

Browse files
committed
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.
1 parent 7530208 commit f9bb496

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/doctest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,13 @@ def __init__(self):
444444
def write(self, s):
445445
self.buf.append(s)
446446
def get(self):
447-
return "".join(self.buf)
447+
guts = "".join(self.buf)
448+
# If anything at all was written, make sure there's a trailing
449+
# newline. There's no way for the expected output to indicate
450+
# that a trailing newline is missing.
451+
if guts and not guts.endswith("\n"):
452+
guts = guts + "\n"
453+
return guts
448454
def clear(self):
449455
self.buf = []
450456
def flush(self):

0 commit comments

Comments
 (0)