





'''simple docstring'''




import unittest

from knapsack import greedy_knapsack as kp






class UpperCAmelCase       (		unittest.TestCase							):



    def 					__lowerCamelCase						(  self					):
     __UpperCAmelCase					=   [10, 20, 30, 40, 50, 60]
     __UpperCAmelCase					=   [2, 4, 6, 8, 10, 12]
     __UpperCAmelCase					=   100
     self.assertEqual(kp.calc_profit(__A     ,			__A     ,			__A					)     ,			210					)



    def 					__lowerCamelCase						(  self					):
     self.assertRaisesRegex(__A     ,			'max_weight must greater than zero.'					)



    def 					__lowerCamelCase						(  self					):
     self.assertRaisesRegex(__A     ,			'Weight can not be negative.'					)



    def 					__lowerCamelCase						(  self					):
     self.assertRaisesRegex(__A     ,			'Profit can not be negative.'					)



    def 					__lowerCamelCase						(  self					):
     self.assertRaisesRegex(__A     ,			'max_weight must greater than zero.'					)




    def 					__lowerCamelCase						(  self					):
     self.assertRaisesRegex(
         __A     ,			'The length of profit and weight must be same.'					)


if __name__ == "__main__":
    unittest.main()












'''simple docstring'''




from __future__ import annotations







def _lowerCAmelCase     (      _lowerCAmelCase    )->     int:
 if not nums:
  return 0
 __UpperCAmelCase					=   nums[0]
 __UpperCAmelCase					=   0
 for num in nums[1:]:
  __UpperCAmelCase					,    __UpperCAmelCase					=   (
      max_excluding + num,
      max(_lowerCAmelCase       ,    _lowerCAmelCase    ),
  )
 return max(_lowerCAmelCase       ,    _lowerCAmelCase    )


if __name__ == "__main__":
    import doctest

    doctest.testmod()





