diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-01-02 10:20:40 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-01-02 10:20:40 -0600 |
commit | f5992ffa148226ea05fecd42bda0715e05bb5a8e (patch) | |
tree | 5a2b6cb8c8d569ff50ef252b6deac865c3b5422d /test_six.py | |
parent | 53cdae597c8de9378d879ec63da4cf510f82d329 (diff) | |
download | six-git-f5992ffa148226ea05fecd42bda0715e05bb5a8e.tar.gz |
support the flush parameter of print_ (fixes #106)
Diffstat (limited to 'test_six.py')
-rw-r--r-- | test_six.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py index 3a3faff..76a8ccb 100644 --- a/test_six.py +++ b/test_six.py @@ -636,6 +636,17 @@ def test_print_(): out = six.StringIO() six.print_(None, file=out) assert out.getvalue() == "None\n" + class FlushableStringIO(six.StringIO): + def __init__(self): + six.StringIO.__init__(self) + self.flushed = False + def flush(self): + self.flushed = True + out = FlushableStringIO() + six.print_("Hello", file=out) + assert not out.flushed + six.print_("Hello", file=out, flush=True) + assert out.flushed @py.test.mark.skipif("sys.version_info[:2] >= (2, 6)") |