Ejemplo n.º 1
0
    def test_input_5_should_return_five(self, mock):
        mock.return_value = 5
        result = print_random_number()
        self.assertEqual(result, "five")


# unittest.main()
Ejemplo n.º 2
0
    def test_get_5_should_return_three(self, mock):
        mock.return_value = 5
        result = print_random_number()
        self.assertEqual(result, 'five')


# comment this for run pytest
# unittest.main()
Ejemplo n.º 3
0
 def test_func_should_call_randint_with_1_and_10(self, mock):
     print_random_number()
     mock.assert_called_once_with(1, 10)
Ejemplo n.º 4
0
 def test_get_3_should_return_three(self, mock):
     mock.return_value = 3
     result = print_random_number()
     self.assertEqual(result, 'three')
Ejemplo n.º 5
0
 def test_get_5_should_return_five(self, mock):
     mock.return_value = 5
     result = print_random_number()
     self.assertEqual(result, 'five')