


'''simple docstring'''
import unittest

from knapsack import greedy_knapsack as kp
class    lowercase	(							unittest.TestCase					):

		"""simple docstring"""

		def     lowerCAmelCase__				(		self							):

							'''simple docstring'''


							UpperCamelCase__   :List[str]												= [10, 20, 30, 40, 50, 60]
							UpperCamelCase__   :Optional[int]												= [2, 4, 6, 8, 10, 12]
							UpperCamelCase__   :Dict												= 100
							self.assertEqual(kp.calc_profit(UpperCamelCase_    ,   UpperCamelCase_    ,   UpperCamelCase_							)    ,   210							)




		def     lowerCAmelCase__				(		self							):

							'''simple docstring'''


							self.assertRaisesRegex(UpperCamelCase_    ,   '''max_weight must greater than zero.'''							)




		def     lowerCAmelCase__				(		self							):

							'''simple docstring'''


							self.assertRaisesRegex(UpperCamelCase_    ,   '''Weight can not be negative.'''							)




		def     lowerCAmelCase__				(		self							):

							'''simple docstring'''


							self.assertRaisesRegex(UpperCamelCase_    ,   '''Profit can not be negative.'''							)




		def     lowerCAmelCase__				(		self							):

							'''simple docstring'''


							self.assertRaisesRegex(UpperCamelCase_    ,   '''max_weight must greater than zero.'''							)




		def     lowerCAmelCase__				(		self							):

							'''simple docstring'''


							self.assertRaisesRegex(
							    UpperCamelCase_    ,   '''The length of profit and weight must be same.'''							)


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






def _a				(	lowerCamelCase:   dict )	->						bool:







      '''simple docstring'''






      __A          =				set()
      # To detect a back edge, keep track of vertices currently in the recursion stack
      __A          =				set()
      return any(
          node not in visited and depth_first_search(lowerCamelCase					,				lowerCamelCase					,				lowerCamelCase					,				lowerCamelCase )
          for node in graph )



def _a				(	lowerCamelCase:   dict					,				lowerCamelCase:   int					,				lowerCamelCase:   set					,				lowerCamelCase:   set )	->						bool:







      '''simple docstring'''






      visited.add(lowerCamelCase )
      rec_stk.add(lowerCamelCase )

      for node in graph[vertex]:
            if node not in visited:
                  if depth_first_search(lowerCamelCase					,				lowerCamelCase					,				lowerCamelCase					,				lowerCamelCase ):
                        return True
            elif node in rec_stk:
                  return True

    # The node needs to be removed from recursion stack before function ends
      rec_stk.remove(lowerCamelCase )
      return False


if __name__ == "__main__":
       from doctest import testmod

       testmod()





