Last active
June 16, 2016 20:17
-
-
Save pjz/ca9c384edce1e45f74c2ec2ab440c50d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_ma_short_skips(): | |
ma = MovingAverage([1,2,5,10]) | |
for i in range(11): | |
ma.update(i, 5) | |
assert ma.cur == [ 5, 5, 5, 5 ] | |
ma = MovingAverage([1,2,3]) | |
for t, v in enumerate([2, 4, 6, 8]): | |
ma.update(t, v) | |
assert ma.cur == [7, 6, 5] | |
def test_ma_long_skips(): | |
ma = MovingAverage([1,2,5,10]) | |
ma.update(0, 6) | |
ma.update(20, 6) | |
assert ma.cur == [ 6, 6, 6, 6 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment