Пример #1
0
 def test_prompt_yesno_user_input_invalid(self):
     ui = UI(None, logging.DEBUG)
     with mock.patch('datarobot_batch_scoring.utils.input') as m_input:
         m_input.side_effect = ['invalid', 'yes']
         assert ui.prompt_yesno('msg')
         m_input.assert_has_calls([mock.call('msg (Yes/No)> '),
                                   mock.call('Please type (Yes/No)> ')])
Пример #2
0
 def test_prompt_yesno_user_input_n(self):
     ui = UI(None, logging.DEBUG)
     with mock.patch('datarobot_batch_scoring.utils.input') as m_input:
         m_input.return_value = 'n'
         assert not ui.prompt_yesno('msg')
         m_input.assert_called_with('msg (Yes/No)> ')
Пример #3
0
 def test_prompt_yesno_always_no(self):
     ui = UI(False, logging.DEBUG)
     with mock.patch('datarobot_batch_scoring.utils.input') as m_input:
         assert not ui.prompt_yesno('msg')
         assert not m_input.called