コード例 #1
0
	def test_function3(self):
		""" Function vpw returns 2 with input V = [3,5,2], W = [6,2,1] and i = 2 """
		with patch("builtins.input", return_value="1") as input_call:
			import attempt
			self.assertEqual(attempt.vpw([3,5,2],[6,2,1],2), 2)
コード例 #2
0
	def test_function5(self):
		""" Function vpw returns 1 with input V = [7,6,5,4,3], W = [3,4,5,6,7] and i = 2 """
		with patch("builtins.input", return_value="1") as input_call:
			import attempt
			self.assertAlmostEqual(attempt.vpw([7,6,5,4,3],[3,4,5,6,7],2), 1)
コード例 #3
0
 def test_function2(self):
     """ Function returns 0.5 with input V = [3,5,2], W = [6,2,1] and i = 0 """
     with patch("builtins.input", return_value="1") as input_call:
         import attempt
         self.assertEqual(attempt.vpw([3, 5, 6], [6, 2, 1], 0), 0.5)