deb-python-misaka/tests/test_smartypants.py

38 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from chibitest import TestCase, ok
from misaka import smartypants
class SmartypantsTest(TestCase):
def test_apostrophes(self):
ok(smartypants('\'s')) == '’s'
ok(smartypants('\'t')) == '’t'
ok(smartypants('\'m')) == '’m'
ok(smartypants('\'d')) == '’d'
ok(smartypants('\'re')) == '’re'
ok(smartypants('\'ll')) == '’ll'
ok(smartypants('\'ve')) == '’ve'
def test_double_quotes(self):
ok(smartypants('"Quotes"')) == '“Quotes”'
def test_dash(self):
ok(smartypants('--')) == '–'
ok(smartypants('---')) == '—'
def test_ellipsis(self):
ok(smartypants('...')) == '…'
ok(smartypants('. . .')) == '…'
def test_parens(self):
ok(smartypants('(c)')) == '©'
ok(smartypants('(r)')) == '®'
ok(smartypants('(tm)')) == '™'
def test_fractions(self):
ok(smartypants('3/4ths')) == '¾ths'
ok(smartypants('3/4')) == '¾'
ok(smartypants('1/2')) == '½'
ok(smartypants('1/4')) == '¼'