summaryrefslogtreecommitdiff
path: root/docutils/test/test_readers/test_python
diff options
context:
space:
mode:
Diffstat (limited to 'docutils/test/test_readers/test_python')
-rw-r--r--docutils/test/test_readers/test_python/__init__.py14
-rwxr-xr-xdocutils/test/test_readers/test_python/showast57
-rwxr-xr-xdocutils/test/test_readers/test_python/showdoc33
-rwxr-xr-xdocutils/test/test_readers/test_python/showparse48
-rwxr-xr-xdocutils/test/test_readers/test_python/showtok40
-rw-r--r--docutils/test/test_readers/test_python/test_functions.py56
-rw-r--r--docutils/test/test_readers/test_python/test_parser.py745
-rw-r--r--docutils/test/test_readers/test_python/test_token_parser.py46
8 files changed, 0 insertions, 1039 deletions
diff --git a/docutils/test/test_readers/test_python/__init__.py b/docutils/test/test_readers/test_python/__init__.py
deleted file mode 100644
index 2fe79c55c..000000000
--- a/docutils/test/test_readers/test_python/__init__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-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/showast b/docutils/test/test_readers/test_python/showast
deleted file mode 100755
index e7d846307..000000000
--- a/docutils/test/test_readers/test_python/showast
+++ /dev/null
@@ -1,57 +0,0 @@
-#! /usr/bin/env python
-
-"""
-This is a tool for exploring abstract syntax trees generated by
-``compiler.parse()`` from test data in
-docutils/test/test_readers/test_python/test_parser or stdin.
-
-Usage::
-
- showast <key> <index>
-
- showast < <module.py>
-
-Where ``<key>`` is the key to the ``totest`` dictionary, and ``<index>`` is
-the index of the list ``totest[key]``. If no arguments are given, stdin is
-used for input.
-"""
-
-import sys
-import compiler
-from compiler.ast import Node
-import test_parser
-
-def pformat(ast, indent=' ', level=0):
- assert isinstance(ast, Node), 'ast is not a Node: %r' % (ast,)
- atts = {}
- for name, value in vars(ast).items():
- if not value or isinstance(value, Node):
- continue
- if isinstance(value, list):
- if isinstance(value[0], Node):
- continue
- if isinstance(value[0], tuple) and value[0] \
- and isinstance(value[0][0], Node):
- continue
- atts[name] = str(value).encode('unicode-escape')
- attlist = atts.items()
- attlist.sort()
- parts = [ast.__class__.__name__]
- for name, value in attlist:
- parts.append('%s="%s"' % (name, value))
- result = ['%s<%s>\n' % (indent * level, ' '.join(parts))]
- for node in ast.getChildNodes():
- result.extend(pformat(node, level=level+1))
- return result
-
-if len(sys.argv) > 1:
- key, caseno = sys.argv[1:]
- print 'totest["%s"][%s][0]:\n' % (key, caseno)
- input_text = test_parser.totest[key][int(caseno)][0]
-else:
- input_text = sys.stdin.read()
-print input_text
-module = compiler.parse(input_text)
-print module
-print
-print ''.join(pformat(module)),
diff --git a/docutils/test/test_readers/test_python/showdoc b/docutils/test/test_readers/test_python/showdoc
deleted file mode 100755
index 6461960f8..000000000
--- a/docutils/test/test_readers/test_python/showdoc
+++ /dev/null
@@ -1,33 +0,0 @@
-#! /usr/bin/env python
-
-"""
-This is a tool for exploring module documentation trees generated by
-``docutils.readers.python.moduleparser.parse_module()`` from test data in
-docutils/test/test_readers/test_python/test_parser or stdin.
-
-Usage::
-
- showdoc <key> <index>
-
- showdoc < <module.py>
-
-Where ``<key>`` is the key to the ``totest`` dictionary, and ``<index>`` is
-the index of the list ``totest[key]``. If no arguments are given, stdin is
-used for input.
-"""
-
-import sys
-from docutils.readers.python.moduleparser import parse_module
-import test_parser
-
-if len(sys.argv) > 1:
- key, caseno = sys.argv[1:]
- print 'totest["%s"][%s][0]:\n' % (key, caseno)
- input_text = test_parser.totest[key][int(caseno)][0]
- input_source = "test_parser.totest['%s'][%s][0]" % (key, caseno)
-else:
- input_text = sys.stdin.read()
- input_source = '<stdin>'
-print input_text
-module = parse_module(input_text, input_source)
-print module,
diff --git a/docutils/test/test_readers/test_python/showparse b/docutils/test/test_readers/test_python/showparse
deleted file mode 100755
index 8144256d6..000000000
--- a/docutils/test/test_readers/test_python/showparse
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /usr/bin/env python
-
-"""
-This is a tool for exploring abstract syntax trees generated by
-``parser.suite()`` from test data in
-docutils/test/test_readers/test_python/test_parser or stdin.
-
-Usage::
-
- showparse <key> <index>
-
- showparse < <module.py>
-
-Where ``<key>`` is the key to the ``totest`` dictionary, and ``<index>`` is
-the index of the list ``totest[key]``. If no arguments are given, stdin is
-used for input.
-"""
-
-import sys
-import types
-import parser
-import token
-import symbol
-import pprint
-import test_parser
-
-names = token.tok_name.copy()
-names.update(symbol.sym_name)
-
-def name_elements(ast):
- if ast:
- name = names[ast[0]]
- ast[0] = '%s (%s)' % (name, ast[0])
- for node in ast[1:]:
- if type(node) == types.ListType:
- name_elements(node)
-
-if len(sys.argv) > 1:
- key, caseno = sys.argv[1:]
- print 'totest["%s"][%s][0]:\n' % (key, caseno)
- input_text = test_parser.totest[key][int(caseno)][0]
-else:
- input_text = sys.stdin.read()
-print input_text
-module = parser.suite(input_text)
-ast = parser.ast2list(module, line_info=1)
-name_elements(ast)
-pprint.pprint(ast)
diff --git a/docutils/test/test_readers/test_python/showtok b/docutils/test/test_readers/test_python/showtok
deleted file mode 100755
index efd250ce1..000000000
--- a/docutils/test/test_readers/test_python/showtok
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /usr/bin/env python
-
-
-"""
-This is a tool for exploring token lists generated by
-``tokenize.generate_tokens()`` from test data in
-docutils/test/test_readers/test_python/test_parser or stdin.
-
-Usage::
-
- showtok <key> <index>
-
- showtok < <module.py>
-
-Where ``<key>`` is the key to the ``totest`` dictionary, and ``<index>`` is
-the index of the list ``totest[key]``. If no arguments are given, stdin is
-used for input.
-"""
-
-import sys
-import tokenize
-import pprint
-from token import tok_name
-import test_parser
-
-def name_tokens(tokens):
- for i in range(len(tokens)):
- tup = tokens[i]
- tokens[i] = (tok_name[tup[0]], tup)
-
-if len(sys.argv) > 1:
- key, caseno = sys.argv[1:]
- print 'totest["%s"][%s][0]:\n' % (key, caseno)
- input_text = test_parser.totest[key][int(caseno)][0]
-else:
- input_text = sys.stdin.read()
-print input_text
-tokens = list(tokenize.generate_tokens(iter(input_text.splitlines(1)).next))
-name_tokens(tokens)
-pprint.pprint(tokens)
diff --git a/docutils/test/test_readers/test_python/test_functions.py b/docutils/test/test_readers/test_python/test_functions.py
deleted file mode 100644
index d521b2203..000000000
--- a/docutils/test/test_readers/test_python/test_functions.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /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 first line.
-
- Middle line indented.
-
-Last line unindented."""),
- ("""
- Begins on the second line.
-
- Middle line indented.
-
- Last line unindented.""",
- """\
-Begins on the second line.
-
- Middle line indented.
-
-Last line unindented."""),
- ("""All on one line.""", """All on one line."""))
-
- def test_trim_docstring(self):
- for docstring, expected in self.docstrings:
- self.assertEquals(trim_docstring(docstring), expected)
- self.assertEquals(trim_docstring('\n ' + docstring),
- expected)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/docutils/test/test_readers/test_python/test_parser.py b/docutils/test/test_readers/test_python/test_parser.py
deleted file mode 100644
index ce70cc27c..000000000
--- a/docutils/test/test_readers/test_python/test_parser.py
+++ /dev/null
@@ -1,745 +0,0 @@
-#! /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 docutils/readers/python/moduleparser.py.
-"""
-
-from __init__ import DocutilsTestSupport
-
-
-def suite():
- s = DocutilsTestSupport.PythonModuleParserTestSuite()
- s.generateTests(totest)
- return s
-
-totest = {}
-
-totest['module'] = [
-['''\
-''',
-'''\
-<Module filename="test data">
-'''],
-['''\
-"""docstring"""
-''',
-'''\
-<Module filename="test data">
- <Docstring>
- docstring
-'''],
-['''\
-u"""Unicode docstring"""
-''',
-'''\
-<Module filename="test data">
- <Docstring>
- Unicode docstring
-'''],
-['''\
-"""docstring"""
-"""additional docstring"""
-''',
-'''\
-<Module filename="test data">
- <Docstring>
- docstring
- <Docstring lineno="2">
- additional docstring
-'''],
-['''\
-"""docstring"""
-# comment
-"""additional docstring"""
-''',
-'''\
-<Module filename="test data">
- <Docstring>
- docstring
- <Docstring lineno="3">
- additional docstring
-'''],
-['''\
-"""docstring"""
-1
-"""not an additional docstring"""
-''',
-'''\
-<Module filename="test data">
- <Docstring>
- docstring
-'''],
-]
-
-totest['import'] = [
-['''\
-import module
-''',
-'''\
-<Module filename="test data">
- <Import lineno="1">
- module
-'''],
-['''\
-import module as local
-''',
-'''\
-<Module filename="test data">
- <Import lineno="1">
- module as local
-'''],
-['''\
-import module.name
-''',
-'''\
-<Module filename="test data">
- <Import lineno="1">
- module.name
-'''],
-['''\
-import module.name as local
-''',
-'''\
-<Module filename="test data">
- <Import lineno="1">
- module.name as local
-'''],
-['''\
-import module
-"""not documentable"""
-''',
-'''\
-<Module filename="test data">
- <Import lineno="1">
- module
-'''],
-]
-
-totest['from'] = [
-['''\
-from module import name
-''',
-'''\
-<Module filename="test data">
- <Import from="module" lineno="1">
- name
-'''],
-['''\
-from module import name as local
-''',
-'''\
-<Module filename="test data">
- <Import from="module" lineno="1">
- name as local
-'''],
-['''\
-from module import name1, name2 as local2
-''',
-'''\
-<Module filename="test data">
- <Import from="module" lineno="1">
- name1
- name2 as local2
-'''],
-['''\
-from module.sub import name
-''',
-'''\
-<Module filename="test data">
- <Import from="module.sub" lineno="1">
- name
-'''],
-['''\
-from module.sub import name as local
-''',
-'''\
-<Module filename="test data">
- <Import from="module.sub" lineno="1">
- name as local
-'''],
-['''\
-from module import *
-''',
-'''\
-<Module filename="test data">
- <Import from="module" lineno="1">
- *
-'''],
-['''\
-from __future__ import division
-''',
-'''\
-<Module filename="test data">
- <Import from="__future__" lineno="1">
- division
-'''],
-]
-
-totest['assign'] = [
-['''\
-a = 1
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1
-'''],
-['''a = 1''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1
-'''],
-['''\
-a = 1
-"""a's docstring"""
-''', #"
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1
- <Docstring lineno="2">
- a's docstring
-'''], #'
-['''\
-a = 1
-"""a's docstring"""
-"""additional docstring"""
-''', #"
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1
- <Docstring lineno="2">
- a's docstring
- <Docstring lineno="3">
- additional docstring
-'''], #'
-['''\
-a = 1 + 2 * 3 / 4 ** 5
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1 + 2 * 3 / 4 ** 5
-'''],
-['''\
-a = 1 \\
- + 2
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1 + 2
-'''],
-['''\
-a = not 1 and 2 or 3
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- not 1 and 2 or 3
-'''],
-['''\
-a = ~ 1 & 2 | 3 ^ 4
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- ~ 1 & 2 | 3 ^ 4
-'''],
-['''\
-a = `1 & 2`
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- `1 & 2`
-'''],
-['''\
-very_long_name = \\
- x
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="very_long_name">
- <Expression lineno="1">
- x
-'''],
-['''\
-very_long_name \\
- = x
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="very_long_name">
- <Expression lineno="2">
- x
-'''],
-['''\
-very_long_name = \\
- another_long_name = \\
- x
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="very_long_name">
- <Expression lineno="1">
- x
- <Attribute lineno="2" name="another_long_name">
- <Expression lineno="1">
- x
-'''],
-['''\
-a = (1
- + 2)
-b = a.b[1 +
- fn(x, y,
- z, {'key': (1 + 2
- + 3)})][4]
-c = """first line
-second line
- third"""
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- (1 + 2)
- <Attribute lineno="3" name="b">
- <Expression lineno="3">
- a.b[1 + fn(x, y, z, {'key': (1 + 2 + 3)})][4]
- <Attribute lineno="7" name="c">
- <Expression lineno="7">
- """first line\\nsecond line\\n third"""
-'''],
-['''\
-a, b, c = range(3)
-(d, e,
- f) = a, b, c
-g, h, i = j = a, b, c
-k.a, k.b.c, k.d.e.f = a, b, c
-''',
-'''\
-<Module filename="test data">
- <AttributeTuple lineno="1" names="a b c">
- <Expression lineno="1">
- range(3)
- <AttributeTuple lineno="2" names="d e f">
- <Expression lineno="3">
- a, b, c
- <AttributeTuple lineno="4" names="g h i">
- <Expression lineno="4">
- a, b, c
- <Attribute lineno="4" name="j">
- <Expression lineno="4">
- a, b, c
- <AttributeTuple lineno="5" names="k.a k.b.c k.d.e.f">
- <Expression lineno="5">
- a, b, c
-'''],
-['''\
-a = 1 ; b = 2
-print ; c = 3
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- 1
- <Attribute lineno="1" name="b">
- <Expression lineno="1">
- 2
- <Attribute lineno="2" name="c">
- <Expression lineno="2">
- 3
-'''],
-['''\
-a.b = 1
-"""This assignment is noted but ignored unless ``a`` is a function."""
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a.b">
- <Expression lineno="1">
- 1
- <Docstring lineno="2">
- This assignment is noted but ignored unless ``a`` is a function.
-'''],
-['''\
-a[b] = 1
-"""Subscript assignments are ignored."""
-''',
-'''\
-<Module filename="test data">
-'''],
-['''\
-a = foo(b=1)
-''',
-'''\
-<Module filename="test data">
- <Attribute lineno="1" name="a">
- <Expression lineno="1">
- foo(b=1)
-'''],
-# ['''\
-# a = 1
-#
-# """Because of the blank above, this is a module docstring."""
-# ''',
-# '''\
-# <Module filename="test data">
-# <Attribute lineno="1" name="a">
-# <Expression lineno="1">
-# 1
-# <Docstring lineno="3">
-# Because of the blank above, this is a module docstring.
-# '''],
-]
-
-totest['def'] = [
-['''\
-def f():
- """Function f's docstring"""
- """Additional docstring"""
- local = 1
- """Not a docstring, since ``local`` is local."""
-''', # "
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <Docstring lineno="1">
- Function f's docstring
- <Docstring lineno="3">
- Additional docstring
-'''], # '
-['''\
-def f(a, b):
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <ParameterList lineno="1">
- <Parameter lineno="1" name="a">
- <Parameter lineno="1" name="b">
-'''],
-['''\
-def f(a=None, b=1):
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <ParameterList lineno="1">
- <Parameter lineno="1" name="a">
- <Default lineno="1">
- None
- <Parameter lineno="1" name="b">
- <Default lineno="1">
- 1
-'''],
-['''\
-def f(a, (b, c, d)=range(3),
- e=None):
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <ParameterList lineno="1">
- <Parameter lineno="1" name="a">
- <ParameterTuple lineno="1" names="(b, c, d)">
- <Default lineno="1">
- range(3)
- <Parameter lineno="1" name="e">
- <Default lineno="1">
- None
-'''],
-['''\
-def f(*args):
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <ParameterList lineno="1">
- <ExcessPositionalArguments lineno="1" name="args">
-'''],
-['''\
-def f(**kwargs):
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <ParameterList lineno="1">
- <ExcessKeywordArguments lineno="1" name="kwargs">
-'''],
-['''\
-def f(a, b=None, *args, **kwargs):
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <ParameterList lineno="1">
- <Parameter lineno="1" name="a">
- <Parameter lineno="1" name="b">
- <Default lineno="1">
- None
- <ExcessPositionalArguments lineno="1" name="args">
- <ExcessKeywordArguments lineno="1" name="kwargs">
-'''],
-['''\
-def f():
- pass
-f.attrib = 1
-"""f.attrib's docstring"""
-''', # "
-# @@@ When should the Attribute move inside the Function?
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
- <Attribute lineno="3" name="f.attrib">
- <Expression lineno="3">
- 1
- <Docstring lineno="4">
- f.attrib's docstring
-'''], # '
-['''\
-def f():
- def g():
- pass
- """Not a docstring"""
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Function lineno="1" name="f">
-'''],
-]
-
-totest['class'] = [
-['''\
-class C:
- """class C's docstring"""
-''',
-'''\
-<Module filename="test data">
- <Class lineno="1" name="C">
- <Docstring lineno="1">
- class C's docstring
-'''],
-['''\
-class C(Super):
- pass
-
-class D(SuperD, package.module.SuperD):
- pass
-''',
-'''\
-<Module filename="test data">
- <Class bases="Super" lineno="1" name="C">
- <Class bases="SuperD package.module.SuperD" lineno="4" name="D">
-'''],
-['''\
-class C:
- class D:
- pass
- """Not a docstring"""
-''',
-'''\
-<Module filename="test data">
- <Class lineno="1" name="C">
-'''],
-['''\
-class C:
- def f(self):
- self.local = 1
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Class lineno="1" name="C">
- <Method lineno="2" name="f">
- <ParameterList lineno="2">
- <Parameter lineno="2" name="self">
-'''],
-['''\
-class C:
- def __init__(self):
- self.local = 1
- local = 1
-''',
-'''\
-<Module filename="test data">
- <Class lineno="1" name="C">
- <Method lineno="2" name="__init__">
- <ParameterList lineno="2">
- <Parameter lineno="2" name="self">
- <Attribute lineno="3" name="self.local">
- <Expression lineno="3">
- 1
- <Attribute lineno="4" name="local">
- <Expression lineno="4">
- 1
-'''],
-['''\
-class C:
- def __init__(self):
- local = foo(a=1)
-''',
-'''\
-<Module filename="test data">
- <Class lineno="1" name="C">
- <Method lineno="2" name="__init__">
- <ParameterList lineno="2">
- <Parameter lineno="2" name="self">
- <Attribute lineno="3" name="local">
- <Expression lineno="3">
- foo(a=1)
-'''],
-]
-
-totest['ignore'] = [
-['''\
-1 + 2
-''',
-'''\
-<Module filename="test data">
-'''],
-['''\
-del a
-''',
-'''\
-<Module filename="test data">
-'''],
-]
-
-totest['comments'] = [
-# ['''\
-# # Comment
-# ''',
-# '''\
-# <Module filename="test data">
-# <Comment lineno="1">
-# # Comment
-# '''],
-]
-
-# @@@ no comments yet
-totest['everything'] = [
-['''\
-# comment
-
-"""Docstring"""
-
-"""Additional docstring"""
-
-__docformat__ = 'reStructuredText'
-
-a = 1
-"""Attribute docstring"""
-
-class C(Super):
-
- """C's docstring"""
-
- class_attribute = 1
- """class_attribute's docstring"""
-
- def __init__(self, text=None):
- """__init__'s docstring"""
-
- self.instance_attribute = (text * 7
- + ' whaddyaknow')
- """instance_attribute's docstring"""
-
-
-def f(x, # parameter x
- y=a*5, # parameter y
- *args): # parameter args
- """f's docstring"""
- return [x + item for item in args]
-
-f.function_attribute = 1
-"""f.function_attribute's docstring"""
-''',
-'''\
-<Module filename="test data">
- <Docstring>
- Docstring
- <Docstring lineno="5">
- Additional docstring
- <Attribute lineno="7" name="__docformat__">
- <Expression lineno="7">
- 'reStructuredText'
- <Attribute lineno="9" name="a">
- <Expression lineno="9">
- 1
- <Docstring lineno="10">
- Attribute docstring
- <Class bases="Super" lineno="12" name="C">
- <Docstring lineno="12">
- C's docstring
- <Attribute lineno="16" name="class_attribute">
- <Expression lineno="16">
- 1
- <Docstring lineno="17">
- class_attribute's docstring
- <Method lineno="19" name="__init__">
- <Docstring lineno="19">
- __init__'s docstring
- <ParameterList lineno="19">
- <Parameter lineno="19" name="self">
- <Parameter lineno="19" name="text">
- <Default lineno="19">
- None
- <Attribute lineno="22" name="self.instance_attribute">
- <Expression lineno="22">
- (text * 7 + ' whaddyaknow')
- <Docstring lineno="24">
- instance_attribute's docstring
- <Function lineno="27" name="f">
- <Docstring lineno="27">
- f's docstring
- <ParameterList lineno="27">
- <Parameter lineno="27" name="x">
- <Parameter lineno="27" name="y">
- <Default lineno="27">
- a * 5
- <ExcessPositionalArguments lineno="27" name="args">
- <Attribute lineno="33" name="f.function_attribute">
- <Expression lineno="33">
- 1
- <Docstring lineno="34">
- f.function_attribute's docstring
-'''],
-]
-
-"""
-['''\
-''',
-'''\
-'''],
-"""
-
-if __name__ == '__main__':
- import unittest
- unittest.main(defaultTest='suite')
diff --git a/docutils/test/test_readers/test_python/test_token_parser.py b/docutils/test/test_readers/test_python/test_token_parser.py
deleted file mode 100644
index 23015a7dc..000000000
--- a/docutils/test/test_readers/test_python/test_token_parser.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /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 docutils/readers/python/moduleparser.py.
-"""
-
-from __init__ import DocutilsTestSupport
-
-
-def suite():
- s = DocutilsTestSupport.PythonModuleParserTestSuite()
- s.generateTests(totest, testmethod='test_token_parser_rhs')
- return s
-
-totest = {}
-
-totest['expressions'] = [
-['''a = 1''', '''1'''],
-['''a = b = 1''', '''1'''],
-['''\
-a = (
- 1 + 2
- + 3
- )
-''',
-'''(1 + 2 + 3)'''],
-['''\
-a = """\\
-line one
-line two"""
-''',
-'''"""\\\nline one\nline two"""'''],
-['''a = `1`''', '''`1`'''],
-['''a = `1`+`2`''', '''`1` + `2`'''],
-]
-
-
-if __name__ == '__main__':
- import unittest
- unittest.main(defaultTest='suite')