knapsack.tests.test_greedy_knapsack

Classes

TestClass

Test cases for knapsack

Module Contents

class knapsack.tests.test_greedy_knapsack.TestClass(methodName='runTest')

Bases: unittest.TestCase

Test cases for knapsack

test_negative_max_weight()

Returns ValueError for any negative max_weight value :return: ValueError

test_negative_profit_value()

Returns ValueError for any negative profit value in the list :return: ValueError

test_negative_weight_value()

Returns ValueError for any negative weight value in the list :return: ValueError

test_null_max_weight()

Returns ValueError for any zero max_weight value :return: ValueError

test_sorted()

kp.calc_profit takes the required argument (profit, weight, max_weight) and returns whether the answer matches to the expected ones

test_unequal_list_length()

Returns IndexError if length of lists (profit and weight) are unequal. :return: IndexError