Spaces:
Running
Running
| 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() | |