test.test_readers.test_pep.test_rfc2822.py Maven / Gradle / Ivy
#! /usr/bin/env python
# $Id: test_rfc2822.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger
# Copyright: This module has been placed in the public domain.
"""
Tests for RFC-2822 headers in PEPs (readers/pep.py).
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.PEPParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['rfc2822'] = [
["""\
Author: Me
Version: 1
Date: 2002-04-23
""",
"""\
Author
Me
Version
1
Date
2002-04-23
"""],
["""\
Author: Me
Version: 1
Date: 2002-04-23
.. Leading blank lines don't affect RFC-2822 header parsing.
""",
"""\
Author
Me
Version
1
Date
2002-04-23
Leading blank lines don't affect RFC-2822 header parsing.
"""],
["""\
.. A comment should prevent RFC-2822 header parsing.
Author: Me
Version: 1
Date: 2002-04-23
""",
"""\
A comment should prevent RFC-2822 header parsing.
Author: Me
Version: 1
Date: 2002-04-23
"""],
["""\
Author: Me
Version: 1
Date: 2002-04-23
""",
"""\
Author
Me
Version: 1
Date: 2002-04-23
"""],
["""\
field:
empty item above, no blank line
""",
"""\
field
RFC2822-style field list ends without a blank line; unexpected unindent.
empty item above, no blank line
"""],
["""\
Author:
Me
Version:
1
Date:
2002-04-23
""",
"""\
Author
Me
Version
1
Date
2002-04-23
"""],
["""\
Authors: Me,
Myself,
and I
Version: 1
or so
Date: 2002-04-23
(Tuesday)
""",
"""\
Authors
Me,
Myself,
and I
Version
1
or so
Date
2002-04-23
(Tuesday)
"""],
["""\
Authors: Me,
Myself,
and I
Version: 1
or so
Date: 2002-04-23
(Tuesday)
""",
"""\
Authors
Me,
Myself,
and I
Version
1
or so
Date
2002-04-23
(Tuesday)
"""],
["""\
Authors: - Me
- Myself
- I
Version:
""",
"""\
Authors
Me
Myself
I
Version
"""],
["""\
Authors: Me
Myself and I
Version:
""",
"""\
Authors
Me
Myself and I
Block quote ends without a blank line; unexpected unindent.
Version:
"""],
]
if __name__ == '__main__':
import unittest
unittest.main(defaultTest='suite')