Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# $Id: test_section_headers.py 6476 2010-11-10 13:43:50Z milde $
# Author: David Goodger
# Copyright: This module has been placed in the public domain.
"""Tests for states.py."""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['section_headers'] = [
["""\
Title
=====
Paragraph.
""",
"""\
Title
Paragraph.
"""],
["""\
Title
=====
Paragraph (no blank line).
""",
"""\
Title
Paragraph (no blank line).
"""],
["""\
Paragraph.
Title
=====
Paragraph.
""",
"""\
Paragraph.
Title
Paragraph.
"""],
["""\
Test unexpected section titles.
Title
=====
Paragraph.
-----
Title
-----
Paragraph.
""",
"""\
Test unexpected section titles.
Unexpected section title.
Title
=====
Paragraph.
Unexpected section title or transition.
-----
Unexpected section title.
Title
-----
Paragraph.
"""],
["""\
Title
====
Test short underline.
""",
"""\
Title
Title underline too short.
Title
====
Test short underline.
"""],
[u"""\
à with combining varia
======================
Do not count combining chars in title column width.
""",
u"""\
à with combining varia
Do not count combining chars in title column width.
"""],
["""\
=====
Title
=====
Test overline title.
""",
"""\
Title
Test overline title.
"""],
["""\
=======
Title
=======
Test overline title with inset.
""",
"""\
Title
Test overline title with inset.
"""],
["""\
========================
Test Missing Underline
""",
"""\
Incomplete section title.
========================
Test Missing Underline
"""],
["""\
========================
Test Missing Underline
""",
"""\
Missing matching underline for section title overline.
========================
Test Missing Underline
"""],
["""\
=======
Title
Test missing underline, with paragraph.
""",
"""\
Missing matching underline for section title overline.
=======
Title
Test missing underline, with paragraph.
"""],
["""\
=======
Long Title
=======
Test long title and space normalization.
""",
"""\
Long Title
Title overline too short.
=======
Long Title
=======
Test long title and space normalization.
"""],
["""\
=======
Title
-------
Paragraph.
""",
"""\
Title overline & underline mismatch.
=======
Title
-------
Paragraph.
"""],
["""\
========================
========================
Test missing titles; blank line in-between.
========================
========================
""",
"""\
Test missing titles; blank line in-between.
"""],
["""\
========================
========================
Test missing titles; nothing in-between.
========================
========================
""",
"""\
Invalid section title or transition marker.
========================
========================
Test missing titles; nothing in-between.
Invalid section title or transition marker.
========================
========================
"""],
["""\
.. Test return to existing, highest-level section (Title 3).
Title 1
=======
Paragraph 1.
Title 2
-------
Paragraph 2.
Title 3
=======
Paragraph 3.
Title 4
-------
Paragraph 4.
""",
"""\
Test return to existing, highest-level section (Title 3).
Title 1
Paragraph 1.
Title 2
Paragraph 2.
Title 3
Paragraph 3.
Title 4
Paragraph 4.
"""],
["""\
Test return to existing, highest-level section (Title 3, with overlines).
=======
Title 1
=======
Paragraph 1.
-------
Title 2
-------
Paragraph 2.
=======
Title 3
=======
Paragraph 3.
-------
Title 4
-------
Paragraph 4.
""",
"""\
Test return to existing, highest-level section (Title 3, with overlines).
Title 1
Paragraph 1.
Title 2
Paragraph 2.
Title 3
Paragraph 3.
Title 4
Paragraph 4.
"""],
["""\
Test return to existing, higher-level section (Title 4).
Title 1
=======
Paragraph 1.
Title 2
-------
Paragraph 2.
Title 3
```````
Paragraph 3.
Title 4
-------
Paragraph 4.
""",
"""\
Test return to existing, higher-level section (Title 4).
Title 1
Paragraph 1.
Title 2
Paragraph 2.
Title 3
Paragraph 3.
Title 4
Paragraph 4.
"""],
["""\
Test bad subsection order (Title 4).
Title 1
=======
Paragraph 1.
Title 2
-------
Paragraph 2.
Title 3
=======
Paragraph 3.
Title 4
```````
Paragraph 4.
""",
"""\
Test bad subsection order (Title 4).
Title 1
Paragraph 1.
Title 2
Paragraph 2.
Title 3
Paragraph 3.
Title level inconsistent:
Title 4
```````
Paragraph 4.
"""],
["""\
Test bad subsection order (Title 4, with overlines).
=======
Title 1
=======
Paragraph 1.
-------
Title 2
-------
Paragraph 2.
=======
Title 3
=======
Paragraph 3.
```````
Title 4
```````
Paragraph 4.
""",
"""\
Test bad subsection order (Title 4, with overlines).
Title 1
Paragraph 1.
Title 2
Paragraph 2.
Title 3
Paragraph 3.
Title level inconsistent:
```````
Title 4
```````
Paragraph 4.
"""],
["""\
Title containing *inline* ``markup``
====================================
Paragraph.
""",
"""\
Title containing \n\
inline
\n\
markup
Paragraph.
"""],
["""\
1. Numbered Title
=================
Paragraph.
""",
"""\
1. Numbered Title
Paragraph.
"""],
["""\
1. Item 1.
2. Item 2.
3. Numbered Title
=================
Paragraph.
""",
"""\
Item 1.
Item 2.
Enumerated list ends without a blank line; unexpected unindent.
3. Numbered Title
Paragraph.
"""],
["""\
ABC
===
Short title.
""",
"""\
ABC
Short title.
"""],
["""\
ABC
==
Underline too short.
""",
"""\
Possible title underline, too short for the title.
Treating it as ordinary text because it's so short.
ABC
==
Underline too short.
"""],
["""\
==
ABC
==
Over & underline too short.
""",
"""\
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
==
ABC
==
Over & underline too short.
"""],
["""\
==
ABC
Overline too short, no underline.
""",
"""\
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
==
ABC
Overline too short, no underline.
"""],
["""\
==
ABC
""",
"""\
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
==
ABC
"""],
["""\
==
Not a title: a definition list item.
""",
"""\
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
==
Not a title: a definition list item.
"""],
["""\
==
Not a title: a definition list item.
--
Another definition list item. It's in a different list,
but that's an acceptable limitation given that this will
probably never happen in real life.
The next line will trigger a warning:
==
""",
"""\
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
==
Not a title: a definition list item.
Definition list ends without a blank line; unexpected unindent.
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
--
Another definition list item. It's in a different list,
but that's an acceptable limitation given that this will
probably never happen in real life.
The next line will trigger a warning:
Definition list ends without a blank line; unexpected unindent.
==
"""],
["""\
Paragraph
==
ABC
==
Over & underline too short.
""",
"""\
Paragraph
Unexpected possible title overline or transition.
Treating it as ordinary text because it's so short.
==
ABC
==
Over & underline too short.
"""],
["""\
Paragraph
ABC
==
Underline too short.
""",
"""\
Paragraph
ABC
==
Underline too short.
"""],
["""\
...
...
...
---
...
...
...
""",
"""\
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
...
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.