Exemple #1
0
 def test_ask_y_n_without_answer_default_n(self, side_effect):
     result = IO.ask_y_n('Question', 'n')
     self.assertEqual(result, 'n')
Exemple #2
0
 def test_ask_with_default_with_other_answer(self, side_effect):
     result = IO.ask_with_default('Question', 'First answer')
     self.assertEqual(result, 'Another answer')
Exemple #3
0
 def test_get_menu_choice_cancel_when_cant_without_choice(self, side_effect):
     result = IO.get_menu_choice(SIMPLE_MENU, show_cancel=False)
     self.assertEqual(result, 0)
Exemple #4
0
 def test_ask_y_n_answer_y(self, side_effect):
     result = IO.ask_y_n('Question')
     self.assertEqual(result, 'o')
Exemple #5
0
 def test_get_menu_choice_bad_input(self, side_effect):
     # Test un mauvais caractère puis quitte
     result = IO.get_menu_choice(SIMPLE_MENU)
     self.assertEqual(result, -1)
Exemple #6
0
 def test_get_menu_choice_cancel_without_choice(self, side_effect):
     result = IO.get_menu_choice(SIMPLE_MENU)
     self.assertEqual(result, -1)
Exemple #7
0
 def test_get_menu_choice_good_choice(self, side_effect):
     result = IO.get_menu_choice(SIMPLE_MENU)
     self.assertEqual(result, 0)
Exemple #8
0
 def test_is_string_with_dict(self):
     self.assertFalse(IO.is_string({'ok': 'ok'}))
Exemple #9
0
 def test_is_string_with_list(self):
     self.assertFalse(IO.is_string(['A string']))
Exemple #10
0
 def test_is_string_with_int(self):
     self.assertFalse(IO.is_string(2))
Exemple #11
0
 def test_is_string_with_string(self):
     self.assertTrue(IO.is_string('a small string'))