mirror of
https://github.com/romanz/amodem.git
synced 2026-04-20 13:16:42 +08:00
stream: use IOError when file is over.
This commit is contained in:
@@ -4,10 +4,6 @@ import logging
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Timeout(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Reader(object):
|
class Reader(object):
|
||||||
|
|
||||||
def __init__(self, fd, data_type=None, bufsize=4096,
|
def __init__(self, fd, data_type=None, bufsize=4096,
|
||||||
@@ -51,6 +47,6 @@ class Reader(object):
|
|||||||
|
|
||||||
time.sleep(self.wait)
|
time.sleep(self.wait)
|
||||||
|
|
||||||
raise Timeout(self.timeout)
|
raise IOError('timeout')
|
||||||
|
|
||||||
__next__ = next
|
__next__ = next
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ def test_read():
|
|||||||
try:
|
try:
|
||||||
for buf in f:
|
for buf in f:
|
||||||
pass
|
pass
|
||||||
except stream.Timeout as e:
|
except IOError as e:
|
||||||
assert e.args == (f.timeout,)
|
assert e.args == ('timeout',)
|
||||||
|
|||||||
Reference in New Issue
Block a user