diff --git a/greedy_method/greedy_knapsack.py b/greedy_method/greedy_knapsack.py index 92dd81aaaa82..ed6399c740c8 100644 --- a/greedy_method/greedy_knapsack.py +++ b/greedy_method/greedy_knapsack.py @@ -15,10 +15,9 @@ Calculate the maximum profit that the shopkeeper can make given maxmum weight that can be carried. """ -from typing import Union -def calc_profit(profit: list, weight: list, max_weight: int) -> Union[str, int]: +def calc_profit(profit: list, weight: list, max_weight: int) -> int: """ Function description is as follows- :param profit: Take a list of profits diff --git a/greedy_method/test_knapsack.py b/greedy_method/test_knapsack.py index 8f8107bc7009..9d556d2d22f4 100644 --- a/greedy_method/test_knapsack.py +++ b/greedy_method/test_knapsack.py @@ -67,7 +67,9 @@ def test_unequal_list_length(self): # profit = [10, 20, 30, 40, 50] # weight = [2, 4, 6, 8, 10, 12] # max_weight = 100 - self.assertRaisesRegex(IndexError, "The length of profit and weight must be same.") + self.assertRaisesRegex( + IndexError, "The length of profit and weight must be same." + ) if __name__ == "__main__":