Files
deb-python-txaio/test/test_create.py
2015-11-27 02:02:03 -07:00

28 lines
611 B
Python

import txaio
def test_illegal_args(framework):
try:
txaio.create_future(result=1, error=RuntimeError("foo"))
assert False
except ValueError:
pass
def test_create_result(framework):
f = txaio.create_future(result='foo')
if txaio.using_twisted:
assert f.called
else:
assert f.done()
def test_create_error(framework):
f = txaio.create_future(error=RuntimeError("test"))
if txaio.using_twisted:
assert f.called
else:
assert f.done()
# cancel the error; we expected it
txaio.add_callbacks(f, None, lambda _: None)