mirror of
https://github.com/romanz/amodem.git
synced 2026-03-18 23:56:03 +08:00
add file streaming support
This commit is contained in:
22
test_stream.py
Normal file
22
test_stream.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import stream
|
||||
import wave
|
||||
|
||||
|
||||
def test():
|
||||
p = wave.record('-', stdout=wave.sp.PIPE)
|
||||
f = stream.FileBuffer(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'
|
||||
Reference in New Issue
Block a user