Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e5044459
Commit
e5044459
authored
Mar 19, 2008
by
Eric Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use test.test_support.captured_stdout instead of a custom contextmanager.
Thanks Nick Coghlan.
parent
4f4738f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
13 deletions
+1
-13
Lib/test/test_print.py
Lib/test/test_print.py
+1
-13
No files found.
Lib/test/test_print.py
View file @
e5044459
...
...
@@ -14,8 +14,6 @@ except ImportError:
# 2.x
from
StringIO
import
StringIO
from
contextlib
import
contextmanager
NotDefined
=
object
()
# A dispatch table all 8 combinations of providing
...
...
@@ -42,15 +40,6 @@ dispatch = {
lambda
args
,
sep
,
end
,
file
:
print
(
sep
=
sep
,
end
=
end
,
file
=
file
,
*
args
),
}
@
contextmanager
def
stdout_redirected
(
new_stdout
):
save_stdout
=
sys
.
stdout
sys
.
stdout
=
new_stdout
try
:
yield
None
finally
:
sys
.
stdout
=
save_stdout
# Class used to test __str__ and print
class
ClassWith__str__
:
def
__init__
(
self
,
x
):
...
...
@@ -71,8 +60,7 @@ class TestPrint(unittest.TestCase):
end
is
not
NotDefined
,
file
is
not
NotDefined
)]
t
=
StringIO
()
with
stdout_redirected
(
t
):
with
test_support
.
captured_stdout
()
as
t
:
fn
(
args
,
sep
,
end
,
file
)
self
.
assertEqual
(
t
.
getvalue
(),
expected
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment