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