Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion titlecase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 14 additions & 0 deletions titlecase/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Loading