def test_temperature_conversion(self): original_C = 25.5 f = misc_utils.celsius_to_fahrenheit(original_C) back_to_C = misc_utils.fahrenheit_to_celsius(f) assert(str(original_C) == str(back_to_C)) original_F = 93.2 c = misc_utils.fahrenheit_to_celsius(original_F) back_to_F = misc_utils.celsius_to_fahrenheit(c) assert(original_F == back_to_F)
def set_temperature_directly(): if _check_for_temperature_override_removal(): return target_temperature_C = _get_parameter_value("target_temperature_C") target_temperature_F = _get_parameter_value("target_temperature_F") if (target_temperature_C is not None) & (target_temperature_F is not None): abort(400, 'Either set the temperature in Celsius or Fahrenheit, but not both.') if target_temperature_F is not None: target_temperature_C = misc_utils.fahrenheit_to_celsius(float(target_temperature_F)) brew_logic.set_temperature_overwrite(float(target_temperature_C)) print 'Target temperature override set to ' + str(target_temperature_C) + 'C/' + str(misc_utils.celsius_to_fahrenheit(float(target_temperature_C))) + 'F' response.status = 204