<s> from tasa . store import Queue <EOL> from tasa . worker import BaseWorker <EOL> def test_base ( ) : <EOL> class ExampleWorker ( BaseWorker ) : <EOL> qinput = Queue ( '<STR_LIT>' ) <EOL> qoutput = Queue ( '<STR_LIT>' ) <EOL> def run ( self , job ) : <EOL> for x in range ( <NUM_LIT:3> ) : <EOL> yield str ( job ) * ( x + <NUM_LIT:1> ) <EOL> w = ExampleWorker ( ) <EOL> qi = w . qinput <EOL> qo = w . qoutput <EOL> qi . clear ( ) <EOL> qo . clear ( ) <EOL> test_jobs = [ '<STR_LIT:foo>' , '<STR_LIT:bar>' , '<STR_LIT>' ] <EOL> for x in test_jobs : <EOL> qi . send ( x ) <EOL> jobs_run = [ ] <EOL> for job in w : <EOL> if job is None : <EOL> break <EOL> jobs_run . append ( job ) <EOL> assert jobs_run == test_jobs <EOL> assert len ( qo ) == <NUM_LIT:3> * len ( test_jobs ) <EOL> assert '<STR_LIT:foo>' in qo <EOL> assert '<STR_LIT>' in qo <EOL> assert '<STR_LIT:bar>' in qo <EOL> assert '<STR_LIT>' in qo <EOL> assert len ( qo ) == <NUM_LIT:0> </s>
