diff options
| author | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2002-12-05 02:32:25 +0000 |
|---|---|---|
| committer | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2002-12-05 02:32:25 +0000 |
| commit | e8861024e4fff838c2a16a1829c3067efc02deb7 (patch) | |
| tree | 013fdbb012cf4c3f1ce35b5b0dfc8057366b49fe /docutils/test/test_readers/test_python | |
| parent | ca6649883dd9e55153ffef388805677e2d0bc193 (diff) | |
| download | docutils-e8861024e4fff838c2a16a1829c3067efc02deb7.tar.gz | |
initial checkin
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@991 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/test_readers/test_python')
| -rw-r--r-- | docutils/test/test_readers/test_python/.cvsignore | 1 | ||||
| -rw-r--r-- | docutils/test/test_readers/test_python/__init__.py | 14 | ||||
| -rw-r--r-- | docutils/test/test_readers/test_python/test_functions.py | 58 |
3 files changed, 73 insertions, 0 deletions
diff --git a/docutils/test/test_readers/test_python/.cvsignore b/docutils/test/test_readers/test_python/.cvsignore new file mode 100644 index 000000000..0d20b6487 --- /dev/null +++ b/docutils/test/test_readers/test_python/.cvsignore @@ -0,0 +1 @@ +*.pyc diff --git a/docutils/test/test_readers/test_python/__init__.py b/docutils/test/test_readers/test_python/__init__.py new file mode 100644 index 000000000..2fe79c55c --- /dev/null +++ b/docutils/test/test_readers/test_python/__init__.py @@ -0,0 +1,14 @@ +import os +import os.path +import sys + +sys.path.insert(0, os.path.abspath(os.curdir)) +prev = '' +while sys.path[0] != prev: + try: + import DocutilsTestSupport + break + except ImportError: + prev = sys.path[0] + sys.path[0] = os.path.dirname(prev) +sys.path.pop(0) diff --git a/docutils/test/test_readers/test_python/test_functions.py b/docutils/test/test_readers/test_python/test_functions.py new file mode 100644 index 000000000..6cee74502 --- /dev/null +++ b/docutils/test/test_readers/test_python/test_functions.py @@ -0,0 +1,58 @@ +#! /usr/bin/env python + +# Author: David Goodger +# Contact: goodger@users.sourceforge.net +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Tests for PySource Reader functions. +""" + +import unittest +from __init__ import DocutilsTestSupport +from docutils.readers.python.moduleparser import trim_docstring + + +class MiscTests(unittest.TestCase): + + docstrings = ("""""", # empty + """Begins on the first line. + + Middle line indented. + + Last line unindented. + """, + """ + Begins on the second line. + + Middle line indented. + + Last line unindented.""", + """All on one line.""") + expected = ("""""", # empty + """\ +Begins on the first line. + + Middle line indented. + +Last line unindented.""", + """\ +Begins on the second line. + + Middle line indented. + +Last line unindented.""", + """All on one line.""") + + def test_trim_docstring(self): + for i in range(len(self.docstrings)): + self.assertEquals(trim_docstring(self.docstrings[i]), + self.expected[i]) + self.assertEquals(trim_docstring('\n ' + self.docstrings[i]), + self.expected[i]) + + +if __name__ == '__main__': + unittest.main() |
