commit 4239c27de49aef4d5595bfa47366f366a725e6dc
parent ee14edbd23d2022f793b1d8a1a45ea0926f7f589
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sun, 28 May 2023 22:07:29 +0200
[RED] New set point but time has not come -> same required temperature
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/thermostat.py b/thermostat.py
@@ -21,6 +21,7 @@ class TestableThermostat(Thermostat):
def __init__(self, hour):
self.hour = hour
+ self.setPoint = None
def GetCurrentTime(self):
return hour
@@ -38,3 +39,12 @@ class ThermostatTests(unittest.TestCase):
thermostat = TestableThermostat(hour)
thermostat.AddSetPoint(hour, requiredTemperature)
self.assertEqual(thermostat.GetCurrentRequiredTemperature(), requiredTemperature)
+
+ def test_GivenIAddedSetPoint_WhenTimeIsBeforeSetPoint_ThenRequiredTemperatureNotChanged(self):
+ hour = 7
+ requiredTemperature = 25
+ thermostat = TestableThermostat(hour-1)
+ oldRequiredTemperature = thermostat.GetCurrentRequiredTemperature()
+ thermostat.AddSetPoint(hour, requiredTemperature)
+ newRequiredTemperature = thermostat.GetCurrentRequiredTemperature()
+ self.assertEqual(oldRequiredTemperature, newRequiredTemperature)