summaryrefslogtreecommitdiff
path: root/test/test_transforms
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2012-10-16 12:40:36 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2012-10-16 12:40:36 +0000
commit271fd7c07130ab7902be7a46a7a2e1ba9142278e (patch)
treed55fed6dc1d647140dca4fd3d132921c704af920 /test/test_transforms
parent765b890eea4a503784c78b592cb010e35fff36c1 (diff)
downloaddocutils-271fd7c07130ab7902be7a46a7a2e1ba9142278e.tar.gz
Add SmartQuotes transform for typographic quotes and dashes.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7530 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/test_transforms')
-rw-r--r--test/test_transforms/test_smartquotes.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test_transforms/test_smartquotes.py b/test/test_transforms/test_smartquotes.py
new file mode 100644
index 000000000..45b1e7ac5
--- /dev/null
+++ b/test/test_transforms/test_smartquotes.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+
+# $Id$
+
+# :Copyright: © 2011 Günter Milde.
+# :License: Released under the terms of the `2-Clause BSD license`_, in short:
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+# This file is offered as-is, without any warranty.
+#
+# .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause
+
+"""
+Test module for universal.SmartQuotes transform.
+"""
+
+
+from __init__ import DocutilsTestSupport # must be imported before docutils
+from docutils.transforms.universal import SmartQuotes
+from docutils.parsers.rst import Parser
+
+def suite():
+ parser = Parser()
+ s = DocutilsTestSupport.TransformTestSuite(
+ parser, suite_settings={'smart_quotes': True})
+ s.generateTests(totest)
+ return s
+
+
+totest = {}
+
+totest['transitions'] = ((SmartQuotes,), [
+["""\
+Test "smart quotes", 'single smart quotes'
+-- and ---also long--- dashes.
+""",
+u"""\
+<document source="test data">
+ <paragraph>
+ Test “smart quotes”, ‘single smart quotes’
+ – and —also long— dashes.
+"""],
+])
+
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main(defaultTest='suite')