(self)
| 282 | # Override some StringIO methods. |
| 283 | class _SpoofOut(StringIO): |
| 284 | def getvalue(self): |
| 285 | result = StringIO.getvalue(self) |
| 286 | # If anything at all was written, make sure there's a trailing |
| 287 | # newline. There's no way for the expected output to indicate |
| 288 | # that a trailing newline is missing. |
| 289 | if result and not result.endswith("\n"): |
| 290 | result += "\n" |
| 291 | return result |
| 292 | |
| 293 | def truncate(self, size=None): |
| 294 | self.seek(size) |