def test_tee_class(): fileout = StringIO.StringIO() stdout = StringIO.StringIO() tee = TeeHandler(fileout, stdout) tee.write("TEST") assert fileout.getvalue() == "TEST" assert stdout.getvalue() == "TEST" tee.write("SECOND") assert fileout.getvalue() == "TESTSECOND" assert stdout.getvalue() == "TESTSECOND"