All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.test_parsers.test_rst.test_block_quotes.py Maven / Gradle / Ivy

There is a newer version: 2.4
Show newest version
#! /usr/bin/env python

# $Id: test_block_quotes.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['block_quotes'] = [
["""\
Line 1.
Line 2.

   Indented.
""",
"""\

    
        Line 1.
        Line 2.
    
        
            Indented.
"""],
["""\
Line 1.
Line 2.

   Indented 1.

      Indented 2.
""",
"""\

    
        Line 1.
        Line 2.
    
        
            Indented 1.
        
            
                Indented 2.
"""],
["""\
Line 1.
Line 2.
    Unexpectedly indented.
""",
"""\

    
        Line 1.
        Line 2.
    
        
            Unexpected indentation.
    
        
            Unexpectedly indented.
"""],
["""\
Line 1.
Line 2.

   Indented.
no blank line
""",
"""\

    
        Line 1.
        Line 2.
    
        
            Indented.
    
        
            Block quote ends without a blank line; unexpected unindent.
    
        no blank line
"""],
["""\
Here is a paragraph.

        Indent 8 spaces.

    Indent 4 spaces.

Is this correct? Should it generate a warning?
Yes, it is correct, no warning necessary.
""",
"""\

    
        Here is a paragraph.
    
        
            
                Indent 8 spaces.
        
            Indent 4 spaces.
    
        Is this correct? Should it generate a warning?
        Yes, it is correct, no warning necessary.
"""],
["""\
Paragraph.

   Block quote.

   -- Attribution

Paragraph.

   Block quote.

   --Attribution
""",
"""\

    
        Paragraph.
    
        
            Block quote.
        
            Attribution
    
        Paragraph.
    
        
            Block quote.
        
            Attribution
"""],
[u"""\
Alternative: true em-dash.

   Block quote.

   \u2014 Attribution

Alternative: three hyphens.

   Block quote.

   --- Attribution
""",
"""\

    
        Alternative: true em-dash.
    
        
            Block quote.
        
            Attribution
    
        Alternative: three hyphens.
    
        
            Block quote.
        
            Attribution
"""],
["""\
Paragraph.

   Block quote.

   -- Attribution line one
   and line two

Paragraph.

   Block quote.

   -- Attribution line one
      and line two

Paragraph.
""",
"""\

    
        Paragraph.
    
        
            Block quote.
        
            Attribution line one
            and line two
    
        Paragraph.
    
        
            Block quote.
        
            Attribution line one
            and line two
    
        Paragraph.
"""],
["""\
Paragraph.

   Block quote 1.

   -- Attribution 1

   Block quote 2.

   --Attribution 2
""",
"""\

    
        Paragraph.
    
        
            Block quote 1.
        
            Attribution 1
    
        
            Block quote 2.
        
            Attribution 2
"""],
["""\
Paragraph.

   Block quote 1.

   -- Attribution 1

   Block quote 2.
""",
"""\

    
        Paragraph.
    
        
            Block quote 1.
        
            Attribution 1
    
        
            Block quote 2.
"""],
["""\
Unindented paragraph.

    Block quote 1.

    -- Attribution 1

    Block quote 2.

..

    Block quote 3.
""",
"""\

    
        Unindented paragraph.
    
        
            Block quote 1.
        
            Attribution 1
    
        
            Block quote 2.
    
    
        
            Block quote 3.
"""],
["""\
Paragraph.

   -- Not an attribution

Paragraph.

   Block quote.

   \-- Not an attribution

Paragraph.

   Block quote.

   -- Not an attribution line one
      and line two
          and line three
""",
"""\

    
        Paragraph.
    
        
            -- Not an attribution
    
        Paragraph.
    
        
            Block quote.
        
            -- Not an attribution
    
        Paragraph.
    
        
            Block quote.
        
            
                
                    -- Not an attribution line one
                
                    
                        
                            
                                and line two
                            
                                
                                    and line three
"""],
["""\
Paragraph.

   -- Not a valid attribution

   Block quote 1.

   --Attribution 1

   --Invalid attribution

   Block quote 2.

   --Attribution 2
""",
"""\

    
        Paragraph.
    
        
            -- Not a valid attribution
        
            Block quote 1.
        
            Attribution 1
    
        
            --Invalid attribution
        
            Block quote 2.
        
            Attribution 2
"""],
]


if __name__ == '__main__':
    import unittest
    unittest.main(defaultTest='suite')




© 2015 - 2024 Weber Informatics LLC | Privacy Policy