def test_problem1_05(): S = [1, 5, 6, 7]; W = [1, 0] expect = [1, 5, 6, 7] result = quiz.trailing_weighted_average(S, W) assert expect == result result = quiz.trailing_weighted_average(S, W) assert expect == result, "okay on first call, but not second!"
def test_problem1_07(): S = list(range(1,18)); W = list(range(10,0,-1)) expect = [55, 65, 84, 111, 145, 185, 230, 279, 331, 385, 440, 495, 550, 605, 660, 715, 770] result = quiz.trailing_weighted_average(deepcopy(S), deepcopy(W)) assert expect == result
def test_problem1_06(): S = [1, 5, 6, 7]; W = [2, 0, 0, 0, 100] expect = [102, 110, 112, 114] result = quiz.trailing_weighted_average(deepcopy(S), deepcopy(W)) assert expect == result
def test_problem1_04(): S = [1, 5, 6, 7]; W = [0, 1] expect = [1, 1, 5, 6] result = quiz.trailing_weighted_average(deepcopy(S), deepcopy(W)) assert expect == result
def test_problem1_03(): S = [1, 5, 6, 7]; W = [0.5, 0.5] expect = [1.0, 3.0, 5.5, 6.5] result = quiz.trailing_weighted_average(deepcopy(S), deepcopy(W)) assert expect == result
def test_problem1_01(): S = [1, 2]; W = [0.8, 0.7] expect = [1.5, 2.3] result = quiz.trailing_weighted_average(deepcopy(S), deepcopy(W)) assert expect == result