mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
* test_select.py: (some) tests for built-in select module
* test_grammar.py, testall.out: added test for funny things in string literals * token.py, symbol.py: definitions used with built-in parser module. * tokenize.py: added double-quote recognition
This commit is contained in:
parent
52f2c05401
commit
b31c7f732a
6 changed files with 155 additions and 1 deletions
25
Lib/test/test_select.py
Normal file
25
Lib/test/test_select.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Testing select module
|
||||
|
||||
from test_support import *
|
||||
|
||||
def test():
|
||||
import select
|
||||
import os
|
||||
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do date; sleep 3; done'
|
||||
p = os.popen(cmd, 'r')
|
||||
for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
|
||||
print 'timeout =', tout
|
||||
rfd, wfd, xfd = select.select([p], [], [], tout)
|
||||
print rfd, wfd, xfd
|
||||
if (rfd, wfd, xfd) == ([], [], []):
|
||||
continue
|
||||
if (rfd, wfd, xfd) == ([p], [], []):
|
||||
line = p.readline()
|
||||
print `line`
|
||||
if not line:
|
||||
print 'EOF'
|
||||
break
|
||||
continue
|
||||
print 'Heh?'
|
||||
|
||||
test()
|
Loading…
Add table
Add a link
Reference in a new issue