From 68539da7ab5f733ca7f3c188b76d7942e1632fcb Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 10 Oct 2019 15:46:36 +0100 Subject: [PATCH] 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 --- plugins/Format/plugin.py | 2 +- plugins/Format/test.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Format/plugin.py b/plugins/Format/plugin.py index 4d68c8ada..fad81f471 100644 --- a/plugins/Format/plugin.py +++ b/plugins/Format/plugin.py @@ -149,7 +149,7 @@ class Format(callbacks.Plugin): Returns titlecased. """ - irc.reply(text.title()) + irc.reply(string.capwords(text, " ")) title = wrap(title, ['text']) @internationalizeDocstring diff --git a/plugins/Format/test.py b/plugins/Format/test.py index f891e0dd7..34e3828dd 100644 --- a/plugins/Format/test.py +++ b/plugins/Format/test.py @@ -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"')