Merge branch 'master' into tfw_improvements

master
echarlie 2017-07-28 22:32:33 -04:00
commit 4386572775
5 changed files with 11 additions and 5 deletions

View File

@ -22,7 +22,7 @@ subs = [
]
r_google_calc = re.compile(r'calculator-40.gif.*? = (.*?)<')
r_google_calc_exp = re.compile(r'calculator-40.gif.*? = (.*?)<sup>(.*?)<')
r_google_calc_exp = re.compile(r'calculator-40.gif.*? = (.*?)<sup>(.*?)</sup></h2>')
def c(phenny, input):
"""Google calculator."""

View File

@ -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'(.*)')

View File

@ -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('!', '')

View File

@ -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')

View File

@ -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")),