test.test_transforms.test_class.py Maven / Gradle / Ivy
#! /usr/bin/env python
# $Id: test_class.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger
# 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
""",
"""\
paragraph
"""],
["""\
.. class:: two
..
Block quote
""",
"""\
Block quote
"""],
["""\
Block quote
.. class:: three
Paragraph
""",
"""\
Block quote
Paragraph
"""],
["""\
.. class:: four
Section Title
=============
Paragraph
""",
"""\
Section Title
Paragraph
"""],
["""\
.. class:: multiple
paragraph 1
paragraph 2
""",
"""\
paragraph 1
paragraph 2
"""],
["""\
.. class:: multiple
.. Just a comment. It's silly, but possible
""",
"""\
Just a comment. It's silly, but possible
"""],
["""\
.. class::
.. class:: 99
""",
"""\
Error in "class" directive:
1 argument(s) required, 0 supplied.
.. class::
Invalid class attribute value for "class" directive: "99".
.. class:: 99
"""],
["""\
.. class:: one
.. class:: two
multiple class values may be assigned to one element
""",
"""\
multiple class values may be assigned to one element
"""],
["""\
.. class:: one two
multiple class values may be assigned to one element
""",
"""\
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.
""",
"""\
List starts at 2.
Class should apply to list, not to system message.
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.
""",
"""\
List starts at 2.
Class should apply to next paragraph, not to system message.
Enumerated list start value not ordinal-1: "2" (ordinal 2)
A paragraph.
"""],
])
if __name__ == '__main__':
import unittest
unittest.main(defaultTest='suite')