def test_calculate_fuel_method_call(self): # arrange test_list = [20] mock_func = MagicMock() # act calculate_fuel(test_list, mock_func) # assert mock_func.assert_called_once_with(test_list[0])
def test_calculate_fuel_returns_0_when_negative(): """ Verify fuel calculation works """ output = calculate_fuel(2) expected = 0 error = f"Expected {expected}, got {output}" assert output == expected, error
def test_calculate_fuel_100756(): """ Verify fuel calculation works """ output = calculate_fuel(100756) expected = 33583 error = f"Expected {expected}, got {output}" assert output == expected, error
def test_calculate_fuel_1969(): """ Verify fuel calculation works """ output = calculate_fuel(1969) expected = 654 error = f"Expected {expected}, got {output}" assert output == expected, error
def test_calculate_fuel_floors(): """ Verify fuel calculation works """ output = calculate_fuel(14) expected = 2 error = f"Expected {expected}, got {output}" assert output == expected, error
def test_calculate_fuel_result(self): # arrange test_list = [20, 30, 40] mock_func = MagicMock() mock_func.return_value = 5 # act actual = calculate_fuel(test_list, mock_func) # assert self.assertEqual(15, actual)
def test_calculate_fuel(): assert calculate_fuel(12) == 2 assert calculate_fuel(14) == 2 assert calculate_fuel(1969) == 654 assert calculate_fuel(100756) == 33583
def test_cases(self): self.assertEqual(calculate_fuel([12]), 2) self.assertEqual(calculate_fuel([14]), 2) self.assertEqual(calculate_fuel([1969]), 654) self.assertEqual(calculate_fuel([100756]), 33583)