Spaces:
Running
Running
File size: 388 Bytes
03a907a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import unittest
from dataset.problem_18.buggy import moving_average
class TestMovingAverage(unittest.TestCase):
def test_window_3(self):
self.assertEqual(moving_average([1, 2, 3, 4, 5], 3), [2.0, 3.0, 4.0])
def test_window_larger_than_data(self):
self.assertEqual(moving_average([2, 4], 5), [3.0])
if __name__ == "__main__":
unittest.main()
|