mirror of
https://github.com/romanz/amodem.git
synced 2026-02-06 16:48:06 +08:00
23 lines
383 B
Python
23 lines
383 B
Python
import stream
|
|
import wave
|
|
|
|
|
|
def test():
|
|
p = wave.record('-', stdout=wave.sp.PIPE)
|
|
f = stream.Reader(p.stdout)
|
|
|
|
result = zip(range(10), f)
|
|
p.stop()
|
|
|
|
j = 0
|
|
for i, buf in result:
|
|
assert i == j
|
|
assert len(buf) == f.SAMPLES
|
|
j += 1
|
|
|
|
try:
|
|
for buf in f:
|
|
pass
|
|
except IOError as e:
|
|
assert str(e) == 'timeout'
|