diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-08-17 13:59:12 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-08-17 13:59:12 +0000 |
| commit | a4bc0d09f3d1f633a5780976d1f913e083c9564a (patch) | |
| tree | 1777475e88463b08438f0719be97cc087554eadd /test/test_transforms/test_class.py | |
| parent | 60c69f8cf97125135948a3d35b7698ee80921137 (diff) | |
| parent | 2818db9a234cc37008c5f2bb0e821f9b1fa92de2 (diff) | |
| download | docutils-0.3.9.tar.gz | |
re-added docutils-0.3.9 tag one level deeper (without web/ and sandboxes/)docutils-0.3.9
git-svn-id: http://svn.code.sf.net/p/docutils/code/tags/docutils-0.3.9@3815 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/test_transforms/test_class.py')
| -rwxr-xr-x | test/test_transforms/test_class.py | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py new file mode 100755 index 000000000..6fc2b33a5 --- /dev/null +++ b/test/test_transforms/test_class.py @@ -0,0 +1,167 @@ +#! /usr/bin/env python + +# Author: David Goodger +# Contact: goodger@users.sourceforge.net +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Tests for `docutils.transforms.misc.ClassAttribute`. +""" + +from __init__ import DocutilsTestSupport +from docutils.parsers.rst import Parser + + +def suite(): + parser = Parser() + s = DocutilsTestSupport.TransformTestSuite(parser) + s.generateTests(totest) + return s + +totest = {} + +totest['class'] = ((), [ +["""\ +.. class:: one + +paragraph +""", +"""\ +<document source="test data"> + <paragraph classes="one"> + paragraph +"""], +["""\ +.. class:: two +.. + + Block quote +""", +"""\ +<document source="test data"> + <comment xml:space="preserve"> + <block_quote classes="two"> + <paragraph> + Block quote +"""], +["""\ + Block quote + + .. class:: three + +Paragraph +""", +"""\ +<document source="test data"> + <block_quote> + <paragraph> + Block quote + <paragraph classes="three"> + Paragraph +"""], +["""\ +.. class:: four + +Section Title +============= + +Paragraph +""", +"""\ +<document source="test data"> + <section classes="four" ids="section-title" names="section title"> + <title> + Section Title + <paragraph> + Paragraph +"""], +["""\ +.. class:: + +.. class:: 99 +""", +"""\ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "class" directive: + 1 argument(s) required, 0 supplied. + <literal_block xml:space="preserve"> + .. class:: + <system_message level="3" line="3" source="test data" type="ERROR"> + <paragraph> + Invalid class attribute value for "class" directive: "99". + <literal_block xml:space="preserve"> + .. class:: 99 +"""], +["""\ +.. class:: one +.. class:: two + +multiple class values may be assigned to one element +""", +"""\ +<document source="test data"> + <paragraph classes="one two"> + multiple class values may be assigned to one element +"""], +["""\ +.. class:: one two + +multiple class values may be assigned to one element +""", +"""\ +<document source="test data"> + <paragraph classes="one two"> + multiple class values may be assigned to one element +"""], +["""\ +.. class:: fancy + +2. List starts at 2. +3. Class should apply to list, not to system message. +""", +"""\ +<document source="test data"> + <enumerated_list classes="fancy" enumtype="arabic" prefix="" start="2" suffix="."> + <list_item> + <paragraph> + List starts at 2. + <list_item> + <paragraph> + Class should apply to list, not to system message. + <system_message level="1" line="3" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "2" (ordinal 2) +"""], +["""\ +2. List starts at 2. +3. Class should apply to next paragraph, not to system message. + + .. class:: fancy + +A paragraph. +""", +"""\ +<document source="test data"> + <enumerated_list enumtype="arabic" prefix="" start="2" suffix="."> + <list_item> + <paragraph> + List starts at 2. + <list_item> + <paragraph> + Class should apply to next paragraph, not to system message. + <system_message level="1" line="1" source="test data" type="INFO"> + <paragraph> + Enumerated list start value not ordinal-1: "2" (ordinal 2) + <paragraph classes="fancy"> + A paragraph. +"""], +]) + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') |
