def assertRaisesErrno(self, errnos, func, *args):
try:
func(*args)
except zmq.ZMQError as e:
if not hasattr(errnos, '__iter__'):
errnos = (errnos,)
if e.errno not in errnos:
raise AssertionError(
"wrong error raised, expected one of ['%s'], got '%s'" % (
", ".join("%s" % zmq.ZMQError(errno) for errno in errnos),
zmq.ZMQError(e.errno)
),
)
else:
self.fail("Function did not raise any error")
评论列表
文章目录