Format: use string.capwords() - not .title() (#1378)

* use string.capwords() - not .title(). closes #1366

* add test case for "@format title" that checks handling apostrophes

* `assertResponse` evidently needs the relevant subcommand
This commit is contained in:
jesopo 2019-10-10 15:46:36 +01:00 committed by James Lu
parent 3c23faf1bd
commit 68539da7ab
2 changed files with 2 additions and 1 deletions

View File

@ -149,7 +149,7 @@ class Format(callbacks.Plugin):
Returns <text> titlecased.
"""
irc.reply(text.title())
irc.reply(string.capwords(text, " "))
title = wrap(title, ['text'])
@internationalizeDocstring

View File

@ -74,6 +74,7 @@ class FormatTestCase(PluginTestCase):
def testTitle(self):
self.assertResponse('title foo', 'Foo')
self.assertResponse('title foo bar', 'Foo Bar')
self.assertResponse('title foo\'s bar', 'Foo\'s Bar')
def testRepr(self):
self.assertResponse('repr foo bar baz', '"foo bar baz"')