1import txaio 2 3 4def test_illegal_args(framework): 5 try: 6 txaio.create_future(result=1, error=RuntimeError("foo")) 7 assert False 8 except ValueError: 9 pass 10 11 12def test_create_result(framework): 13 f = txaio.create_future(result='foo') 14 if txaio.using_twisted: 15 assert f.called 16 else: 17 assert f.done() 18 19 20def test_create_error(framework): 21 f = txaio.create_future(error=RuntimeError("test")) 22 if txaio.using_twisted: 23 assert f.called 24 else: 25 assert f.done() 26 # cancel the error; we expected it 27 txaio.add_callbacks(f, None, lambda _: None) 28