<s> from nose . tools import with_setup , eq_ as eq <EOL> from test_common import vim , cleanup <EOL> from threading import Timer <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_interrupt_from_another_thread ( ) : <EOL> timer = Timer ( <NUM_LIT:0.5> , lambda : vim . async_call ( lambda : vim . stop_loop ( ) ) ) <EOL> timer . start ( ) <EOL> eq ( vim . next_message ( ) , None ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_exception_in_threadsafe_call ( ) : <EOL> msgs = [ ] <EOL> vim . async_call ( lambda : [ vim . eval ( "<STR_LIT:3>" ) , undefined_variable ] ) <EOL> timer = Timer ( <NUM_LIT:0.5> , lambda : vim . async_call ( lambda : vim . stop_loop ( ) ) ) <EOL> timer . start ( ) <EOL> vim . run_loop ( None , None , err_cb = msgs . append ) <EOL> eq ( len ( msgs ) , <NUM_LIT:1> ) <EOL> msgs [ <NUM_LIT:0> ] . index ( '<STR_LIT>' ) <EOL> msgs [ <NUM_LIT:0> ] . index ( '<STR_LIT>' ) </s>
