def test_request_prompts():
 def run(txt, prompts):
  with settings(prompts=prompts):
   ol = OutputLooper(str, 'upper', None, list(txt), None)
   return ol._get_prompt_response()
 prompts = {'prompt2': 'response2', 'prompt1': 'response1', 'prompt': 'response'}
 eq_(run('this is a prompt for prompt1', prompts), ('prompt1', 'response1'))
 eq_(run('this is a prompt for prompt2', prompts), ('prompt2', 'response2'))
 eq_(run('this is a prompt for promptx:', prompts), (None, None))
 eq_(run('prompt for promp', prompts), (None, None))

def test_request_prompts ( ) : def run ( txt , prompts ) : with settings ( prompts = prompts ) : ol = OutputLooper ( str , 'upper' , None , list ( txt ) , None ) return ol . _get_prompt_response ( ) prompts = { 'prompt2' : 'response2' , 'prompt1' : 'response1' , 'prompt' : 'response' } eq_ ( run ( 'this is a prompt for prompt1' , prompts ) , ( 'prompt1' , 'response1' ) ) eq_ ( run ( 'this is a prompt for prompt2' , prompts ) , ( 'prompt2' , 'response2' ) ) eq_ ( run ( 'this is a prompt for promptx:' , prompts ) , ( None , None ) ) eq_ ( run ( 'prompt for promp' , prompts ) , ( None , None ) )
test valid responses from prompts .