I have a Python Clas with 2 methods.
The first, _getTemperature_()
is protected and the second one is a public method. I have to write a unitTest but I have no clue, how to mock the protected method? I just found tutorials to mock a public method which is used at the test direct. But not in a method which sould be tested.
class StateOn(self):
#Temperature in °C
_target = 15
# currrent Temperature by Sensor in °C
def _getTemperature_(self):
return valueFromSensorXY()
def validateTemperature(self):
if self._getTemperature_() >= self._target:
return StateOff()
Does someone can give me a hint, or an explaination to find a solution about this issue?