From 0fec151ee0b3596016d7a094af13085ef01a8bb4 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Sun, 29 May 2022 15:06:35 -0700 Subject: [PATCH] Convert comment into doctest. --- string_utils.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/string_utils.py b/string_utils.py index dbd50f2..88fc910 100644 --- a/string_utils.py +++ b/string_utils.py @@ -1247,16 +1247,15 @@ def strip_ansi_sequences(in_str: str) -> str: class SprintfStdout(contextlib.AbstractContextManager): """ A context manager that captures outputs to stdout to a buffer - without printing them. e.g.:: + without printing them. - with SprintfStdout() as buf: - print("test") - print("1, 2, 3") - print(buf()) - - This yields:: - - 'test\\n1, 2, 3\\n' + >>> with SprintfStdout() as buf: + ... print("test") + ... print("1, 2, 3") + ... + >>> print(buf(), end='') + test + 1, 2, 3 """ -- 2.46.0