diff --git a/titlecase/__init__.py b/titlecase/__init__.py index fd24431..848cbfe 100755 --- a/titlecase/__init__.py +++ b/titlecase/__init__.py @@ -26,7 +26,7 @@ __version__ = '2.4.1' SMALL = r'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?' -PUNCT = r"""!"“#$%&'‘()*+,\-–‒—―./:;?@[\\\]_`{|}~""" +PUNCT = r"""!"“”#$%&'‘’()*+,\-–‒—―./:;?@[\\\]_`{|}~""" SMALL_WORDS = regex.compile(r'^(%s)$' % SMALL, regex.I) diff --git a/titlecase/tests.py b/titlecase/tests.py index 9265ec0..fc2ebc1 100644 --- a/titlecase/tests.py +++ b/titlecase/tests.py @@ -444,5 +444,19 @@ def test_nbsps(self): self.assertEqual(titlecase(s), 'Text With Nonbreaking Spaces') self.assertEqual(titlecase(s, normalise_space_characters=True), 'Text With Nonbreaking Spaces') +class TestCurlyQuotes(unittest.TestCase): + def test_right_curly_quotes(self): + for source, expected in [ + ('’tis the season', '’Tis the Season'), + ('he said “’tis the season”', 'He Said “’Tis the Season”'), + ('’twas a good day', '’Twas a Good Day'), + ('a title about “the”', 'A Title About “The”'), + ('’the final word', '’The Final Word'), + ('’TIS THE SEASON', '’Tis the Season'), + ]: + with self.subTest(source=source): + self.assertEqual(titlecase(source), expected) + + if __name__ == '__main__': unittest.main()