


import unittest

from knapsack import greedy_knapsack as kp





class 						__SCREAMING_SNAKE_CASE					(      unittest.TestCase ):






     def  a_					(			self		)       ->    Dict:
          _a						=		[10, 20, 30, 40, 50, 60]
          _a						=		[2, 4, 6, 8, 10, 12]
          _a						=		100
          self.assertEqual(kp.calc_profit(__UpperCamelCase     ,							__UpperCamelCase     ,							__UpperCamelCase		)     ,							210		)






     def  a_					(			self		)       ->    Tuple:
          self.assertRaisesRegex(__UpperCamelCase     ,							"max_weight must greater than zero."		)






     def  a_					(			self		)       ->    Union[str, Any]:
          self.assertRaisesRegex(__UpperCamelCase     ,							"Weight can not be negative."		)






     def  a_					(			self		)       ->    int:
          self.assertRaisesRegex(__UpperCamelCase     ,							"Profit can not be negative."		)






     def  a_					(			self		)       ->    Dict:
          self.assertRaisesRegex(__UpperCamelCase     ,							"max_weight must greater than zero."		)






     def  a_					(			self		)       ->    int:
          self.assertRaisesRegex(
              __UpperCamelCase     ,							"The length of profit and weight must be same."		)


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





'''simple docstring'''

from __future__ import annotations

import requests






def __UpperCamelCase   (			__lowerCamelCase		: str				)      ->     dict:







     '''simple docstring'''






     _a						=		F"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"
     return requests.get(__lowerCamelCase				).json()






def __UpperCamelCase   (			__lowerCamelCase		: int = 10				)      ->     list[dict]:







     '''simple docstring'''






     _a						=		"https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
     _a						=		requests.get(__lowerCamelCase				).json()[:max_stories]
     return [get_hackernews_story(__lowerCamelCase				) for story_id in story_ids]






def __UpperCamelCase   (			__lowerCamelCase		: int = 10				)      ->     str:







     '''simple docstring'''






     _a						=		hackernews_top_stories(__lowerCamelCase				)
     return "\n".join("* [{title}]({url})".format(**__lowerCamelCase				) for story in stories				)


if __name__ == "__main__":
   print(hackernews_top_stories_as_markdown())

