def test_filter_ints(self, is_positive_mock): # 7 # preparation v = [3, -4, 0, 5, 8] # execution filter_ints(v) # 8 # verification assert_equal( [call(3), call(-4), call(0), call(5), call(8)], is_positive_mock.call_args_list) # 9
def test_filter_ints(self, is_positive_mock): # 7 : 함수인자에 patch된 함수 이름이 추가됨 # preparation v = [3, -4, 0, 5, 8] # execution filter_ints(v) # 8 : 실제로 is_positive 함수는 실행되지 않음 print("call_args_list:", is_positive_mock.call_args_list) # verification assert_equal( [call(3), call(-4), call(0), call(5), call(8)], is_positive_mock.call_args_list) # 9 : 실행된 콜의 리스트로 확인함
def test_filter_ints_return_value(self): v = [3, -4, 0, -2, 5, 0, 8, -1] result = filter_ints(v) assert_list_equal([3, 5, 8], result)
def test_filter_ints_return_value(self): v1 = [3, -4, 0, -2, 5, 0, 8, -1] v2 = [7, -3, 0, 0, 9, 1] assert_list_equal([3, 5, 8], filter_ints(v1)) assert_list_equal([7, 9, 1], filter_ints(v2))
def test_filter_ints_return_value(self): v1 = [3, -4, 0, -2, 5, 0, 8, -1] v2 = [7, -3, 0, 0, 9, 1] assert_list_equal([3, 5, 8], filter_ints(v1)) assert_list_equal([7, 9, 1], filter_ints(v2))
def test_filter_ints_return_value(self): v = [3, -4, 0, -2, 5, 0, 8, -1] result = filter_ints(v) assert_list_equal([3, 5, 8], result)