diff --git a/modules/calc.py b/modules/calc.py index baa4be0..0328d2c 100644 --- a/modules/calc.py +++ b/modules/calc.py @@ -22,7 +22,7 @@ subs = [ ] r_google_calc = re.compile(r'calculator-40.gif.*? = (.*?)<') -r_google_calc_exp = re.compile(r'calculator-40.gif.*? = (.*?)(.*?)<') +r_google_calc_exp = re.compile(r'calculator-40.gif.*? = (.*?)(.*?)') def c(phenny, input): """Google calculator.""" diff --git a/modules/info.py b/modules/info.py index 494eeaa..ce3cab2 100644 --- a/modules/info.py +++ b/modules/info.py @@ -42,8 +42,8 @@ def help(phenny, input): "For help with a command, just use .help followed by the name of" " the command, like \".help botsnack\".") phenny.say( - "If you need additional help can check out {helpurl} or you can " - "talk to my owner, {owner}.".format( + "If you need additional help, check out {helpurl} or talk to my " + "owner, {owner}.".format( helpurl=helpurl, owner=phenny.config.owner)) help.rule = (['help', 'command'], r'(.*)') diff --git a/modules/search.py b/modules/search.py index c424d24..43b3ad2 100644 --- a/modules/search.py +++ b/modules/search.py @@ -124,7 +124,7 @@ def bing(phenny, input): bing.commands = ['bing'] bing.example = '.bing swhack' -r_duck = re.compile(r'nofollow" class="[^"]+" href=".+?(http.*?)">') +r_duck = re.compile(r'web-result.*?nofollow.*?href=".+?(http.*?)"', re.DOTALL) def duck_search(query): query = query.replace('!', '') diff --git a/modules/test/test_calc.py b/modules/test/test_calc.py index 13e4839..4a405be 100644 --- a/modules/test/test_calc.py +++ b/modules/test/test_calc.py @@ -36,3 +36,9 @@ class TestCalc(unittest.TestCase): c(self.phenny, input) self.phenny.reply.assert_called_once_with('Sorry, no result.') + + def test_c_quirk(self): + input = Mock(group=lambda x: '24/50') + c(self.phenny, input) + + self.phenny.say.assert_called_once_with('0.48') diff --git a/modules/test/test_weather.py b/modules/test/test_weather.py index 79dd1e9..375196a 100644 --- a/modules/test/test_weather.py +++ b/modules/test/test_weather.py @@ -28,7 +28,7 @@ class TestWeather(unittest.TestCase): ('27959', check_places("Dare County", "North Carolina")), ('48067', check_places("Royal Oak", "Michigan")), ('23606', check_places("Newport News", "Virginia")), - ('23113', check_places("Midlothian", "Virginia")), + ('23113', check_places("Chesterfield County", "Virginia")), ('27517', check_places("Chapel Hill", "North Carolina")), ('15213', check_places("Allegheny County", "Pennsylvania")), ('90210', check_places("Los Angeles County", "California")),