# Path: controller/sensor.py
# class MovingAverage:
# 
#     def __init__(self, maxlen):
#         self.__data = collections.deque(maxlen=maxlen)
# 
#     def clear(self):
#         self.__data.clear()
# 
#     def push(self, value):
#         self.__data.append(value)
# 
#     def all(self):
#         return list(self.__data)
# 
#     def mean(self):
#         return statistics.mean(self.__data) if self.__data else None


import pytest
from controller.sensor import MovingAverage
    from controller.sensor import TemperatureReader
        assert temperature_reader.get_temperature_slope("pool") == 0

    def test_slope_two_values(self, mocker, temperature_reader):
        average = MovingAverage(10)
        for i in range(2):
            average.push(i)
        mock_values = mocker.patch(
            "controller.sensor.TemperatureReader.values", new_callable=mocker.PropertyMock)
        mock_values.return_value = {"pool": average}
        assert temperature_reader.get_temperature_slope("pool") == 60

    def test_slope_constant_values(self, mocker, temperature_reader):
        average = MovingAverage(10)
        for i in range(10):
            average.push(20)
        mock_values = mocker.patch(
            "controller.sensor.TemperatureReader.values", new_callable=mocker.PropertyMock)
        mock_values.return_value = {"pool": average}
        assert temperature_reader.get_temperature_slope("pool") == 0

    def test_slope_increasing(self, mocker, temperature_reader):
        average = MovingAverage(10)
        for i in range(10):
            average.push(i)
        mock_values = mocker.patch(
            "controller.sensor.TemperatureReader.values", new_callable=mocker.PropertyMock)
        mock_values.return_value = {"pool": average}
        assert temperature_reader.get_temperature_slope("pool") == 60

    def test_slope_decreasing(self, mocker, temperature_reader):

# Path: controller/sensor.py
# class MovingAverage:
# 
#     def __init__(self, maxlen):
#         self.__data = collections.deque(maxlen=maxlen)
# 
#     def clear(self):
#         self.__data.clear()
# 
#     def push(self, value):
#         self.__data.append(value)
# 
#     def all(self):
#         return list(self.__data)
# 
#     def mean(self):
#         return statistics.mean(self.__data) if self.__data else None


# Path: test/test_sensor.py
import pytest
from controller.sensor import MovingAverage
    from controller.sensor import TemperatureReader

        assert temperature_reader.get_temperature_slope("pool") == 0

    def test_slope_two_values(self, mocker, temperature_reader):
        average = MovingAverage(10)
        for i in range(2):
            average.push(i)
        mock_values = mocker.patch(
            "controller.sensor.TemperatureReader.values", new_callable=mocker.PropertyMock)
        mock_values.return_value = {"pool": average}
        assert temperature_reader.get_temperature_slope("pool") == 60

    def test_slope_constant_values(self, mocker, temperature_reader):
        average = MovingAverage(10)
        for i in range(10):
            average.push(20)
        mock_values = mocker.patch(
            "controller.sensor.TemperatureReader.values", new_callable=mocker.PropertyMock)
        mock_values.return_value = {"pool": average}
        assert temperature_reader.get_temperature_slope("pool") == 0

    def test_slope_increasing(self, mocker, temperature_reader):
        average = MovingAverage(10)
        for i in range(10):
            average.push(i)
        mock_values = mocker.patch(
            "controller.sensor.TemperatureReader.values", new_callable=mocker.PropertyMock)
        mock_values.return_value = {"pool": average}
        assert temperature_reader.get_temperature_slope("pool") == 60

    def test_slope_decreasing(self, mocker, temperature_reader):

        average = MovingAverage(10)