Exemplo n.º 1
0
 def test_prompt_returns_sole_entry_if_unless_stupid(self):
     entry = 'oneEntry'
     output = prompt([entry],
                     unless_stupid=True,
                     allow_unknown_values=False)
     self.assertEqual(entry, output,
                      'Should return the only possible output')
Exemplo n.º 2
0
 def test_prompt_returns_unknown_values(self, dmenu_show):
     output = prompt(['1', '2', '3'], allow_unknown_values=True)
     self.assertEqual('not in the list', output)
Exemplo n.º 3
0
 def test_prompt_returns_the_selected_value(self, dmenu_show):
     output = prompt(['1', '2', '3'])
     self.assertEqual('2', output)
Exemplo n.º 4
0
 def test_prompt_thows_on_unknown_values(self, dmenu_show):
     self.assertRaises(
         InvalidValue,
         lambda: prompt(['1', '2', '3'], allow_unknown_values=False))
Exemplo n.º 5
0
 def test_prompt_still_prompts_the_user_if_unknown_values(self, dmenu_show):
     prompt(['meh'], unless_stupid=True, allow_unknown_values=True)
     self.assertTrue(dmenu_show.called,
                     'dmenu.show should have been called')