#! /usr/bin/env python # $Id: test_line_blocks.py 4564 2006-05-21 20:44:42Z wiemann $ # 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['line_blocks'] = [ ["""\ | This is a line block. | Line breaks are *preserved*. | This is a second line block. | This is a third. """, """\ This is a line block. Line breaks are \n\ preserved . This is a second line block. This is a third. """], ["""\ | In line blocks, | Initial indentation is *also* preserved. """, """\ In line blocks, Initial indentation is \n\ also preserved. """], ["""\ | Individual lines in line blocks *may* wrap, as indicated by the lack of a vertical bar prefix. | These are called "continuation lines". """, """\ Individual lines in line blocks may wrap, as indicated by the lack of a vertical bar prefix. These are called "continuation lines". """], ["""\ | Inline markup in line blocks may also wrap *to continuation lines*. | But not to following lines. """, """\ Inline markup in line blocks may also wrap \n\ to continuation lines . But not to following lines. """], ["""\ \\| This is not a line block. The vertical bar is simply part of a paragraph. """, """\ | This is not a line block. The vertical bar is simply part of a paragraph. """], ["""\ | This line block is incomplete. There should be a blank line before this paragraph. """, """\ This line block is incomplete. Line block ends without a blank line. There should be a blank line before this paragraph. """], ["""\ | This line block contains | | blank lines. """, """\ This line block contains blank lines. """], ["""\ | The blank lines in this block | \n\ | \n\ | have bogus spaces. """, """\ The blank lines in this block have bogus spaces. """], ["""\ | Initial indentation is also significant and preserved: | | Indented 4 spaces | Not indented | Indented 2 spaces | Indented 4 spaces | Only one space | | Continuation lines may be indented less than their base lines. """, """\ Initial indentation is also significant and preserved: Indented 4 spaces Not indented Indented 2 spaces Indented 4 spaces Only one space Continuation lines may be indented less than their base lines. """], ["""\ | | This block begins and ends with blank lines. | """, """\ This block begins and ends with blank lines. """], ["""\ This is not | a line block. """, """\ This is not | a line block. """], ["""\ | The first line is indented. | The second line is more indented. """, """\ The first line is indented. The second line is more indented. """], ["""\ | The first line is indented. | The second line is less indented. """, """\ The first line is indented. The second line is less indented. """], ["""\ |This is not |a line block | This is an |incomplete line block. """, """\ | This is not | a line block Inline substitution_reference start-string without end-string. Inline substitution_reference start-string without end-string. This is an Line block ends without a blank line. | incomplete line block. Inline substitution_reference start-string without end-string. """], ["""\ | Inline markup *may not | wrap* over several lines. """, """\ Inline markup \n\ * may not wrap* over several lines. Inline emphasis start-string without end-string. """], ["""\ | * Block level markup | * is not recognized. """, """\ * Block level markup * is not recognized. """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite')