Issue #14554: merge with 3.2
diff --git a/Doc/library/test.rst b/Doc/library/test.rst
index 8b998f6..2e8ba32 100644
--- a/Doc/library/test.rst
+++ b/Doc/library/test.rst
@@ -372,7 +372,7 @@
 
       with captured_stdout() as s:
           print("hello")
-      assert s.getvalue() == "hello"
+      assert s.getvalue() == "hello\n"
 
 
 .. function:: temp_cwd(name='tempcwd', quiet=False, path=None)