Skip to content

Commit f73128e

Browse files
author
y-p
committed
CLN: correct stdin override idiom
1 parent f7f7e13 commit f73128e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/tests/test_format.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,12 @@ def test_to_string_repr_unicode(self):
143143
self.assert_(len(line) == line_len)
144144

145145
# it works even if sys.stdin in None
146-
sys.stdin = None
147-
repr(df)
148-
sys.stdin = sys.__stdin__
146+
_stdin= sys.stdin
147+
try:
148+
sys.stdin = None
149+
repr(df)
150+
finally:
151+
sys.stdin = _stdin
149152

150153
def test_to_string_unicode_columns(self):
151154
df = DataFrame({u'\u03c3': np.arange(10.)})

0 commit comments

Comments
 (0)