summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-01-26 21:48:00 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-01-26 21:48:00 (GMT)
commit27fe9fc448ed2669320e1b3e7e43c955137b980a (patch)
treeee48d0e81932b7521baeb14f91b714a32d1dc7f4 /Lib/test
parent0302cf50ebbaf3da5d5358bdfb5f61babb3f1c6f (diff)
downloadcpython-27fe9fc448ed2669320e1b3e7e43c955137b980a.zip
cpython-27fe9fc448ed2669320e1b3e7e43c955137b980a.tar.gz
cpython-27fe9fc448ed2669320e1b3e7e43c955137b980a.tar.bz2
Followup of #4705: we can't skip the binary buffering layer for stdin because FileIO doesn't have a read1() method
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_cmd_line.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index e567184..77bd6bb 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -159,6 +159,16 @@ class CmdLineTest(unittest.TestCase):
self.assertEqual(data.strip(), b'x',
"text %s not line-buffered" % stream)
+ def test_unbuffered_input(self):
+ # sys.stdin still works with '-u'
+ code = ("import sys; sys.stdout.write(sys.stdin.read(1))")
+ p = _spawn_python('-u', '-c', code)
+ p.stdin.write(b'x')
+ p.stdin.flush()
+ data, rc = _kill_python_and_exit_code(p)
+ self.assertEqual(rc, 0)
+ self.assertEqual(data.strip(), b'x')
+
def test_main():
test.support.run_unittest(CmdLineTest)