title: How to mock a protected/private method in a tested method?
body: <p>I have a Python Clas with 2 methods.</p>
  
  <p>The first, <code>_getTemperature_()</code> 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.</p>
  
  <pre><code>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_() &gt;= self._target:
              return StateOff()
  </code></pre>
  
  <p>Does someone can give me a hint, or an explaination to find a solution about this issue?</p>