Skip to content

Commit 0ddaed3

Browse files
committed
Close #19396: make test_contextlib tolerate -S
1 parent 7bad39f commit 0ddaed3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/test/test_contextlib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,11 @@ class TestRedirectStdout(unittest.TestCase):
636636

637637
def test_redirect_to_string_io(self):
638638
f = io.StringIO()
639+
msg = "Consider an API like help(), which prints directly to stdout"
639640
with redirect_stdout(f):
640-
help(pow)
641-
s = f.getvalue()
642-
self.assertIn('pow', s)
641+
print(msg)
642+
s = f.getvalue().strip()
643+
self.assertEqual(s, msg)
643644

644645
def test_enter_result_is_target(self):
645646
f = io.StringIO()

0 commit comments

Comments
 (0)