Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

19 lines (16 sloc) 0.494 kb
import UnitTest
from StringIO import StringIO
import sys
class StringIOModuleTest(UnitTest.UnitTest):
def test_write(self):
data = StringIO()
data.write('straight')
self.assertEqual(data.getvalue(), 'straight')
def test_print(self):
orig_stdout = sys.stdout
try:
sys.stdout = StringIO()
print 'stdout'
self.assertEqual(sys.stdout.getvalue(), 'stdout\n')
finally:
sys.stdout = orig_stdout
Jump to Line
Something went wrong with that request. Please try again.