From 0a859620972119ea1eb5dc69ad83f6e7d4fb43f5 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Thu, 27 Jul 2017 08:57:47 -0700 Subject: [PATCH] weather bot: Fix for integer division in python2 and adjust test. Fixes #31. --- zulip_bots/zulip_bots/bots/weather/test_weather.py | 2 +- zulip_bots/zulip_bots/bots/weather/weather.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/weather/test_weather.py b/zulip_bots/zulip_bots/bots/weather/test_weather.py index bfbb259d..f3342c17 100644 --- a/zulip_bots/zulip_bots/bots/weather/test_weather.py +++ b/zulip_bots/zulip_bots/bots/weather/test_weather.py @@ -33,7 +33,7 @@ class TestWeatherBot(BotTestCase): ) # Only country query: returns the weather of the capital city - bot_response = "Weather in London, GB:\n58.33 F / 14.85 C\nShower Rain" + bot_response = "Weather in London, GB:\n58.73 F / 14.85 C\nShower Rain" with self.mock_config_info({'key': '123456'}), \ self.mock_http_conversation('test_only_country'): self.initialize_bot() diff --git a/zulip_bots/zulip_bots/bots/weather/weather.py b/zulip_bots/zulip_bots/bots/weather/weather.py index c0449f07..08a815b8 100644 --- a/zulip_bots/zulip_bots/bots/weather/weather.py +++ b/zulip_bots/zulip_bots/bots/weather/weather.py @@ -53,6 +53,6 @@ def to_celsius(temp_kelvin): def to_fahrenheit(temp_kelvin): - return int(temp_kelvin) * 9 / 5 - 459.67 + return int(temp_kelvin) * (9. / 5.) - 459.67 handler_class = WeatherHandler