Update of /cvsroot/happydoc/HappyDoc3/TestCases/parseinfo
In directory usw-pr-cvs1:/tmp/cvs-serv32400/TestCases/parseinfo
Added Files:
__init__.py emptytest.py test_bug434946.py
test_decorated_comments.py test_function_params.py
test_ignore_comments.py test_import_statements.py
test_nested_structures.py test_variable_extraction.py
test_variable_extraction_with_exception.py
Log Message:
Add test files.
--- NEW FILE: __init__.py ---
--- NEW FILE: emptytest.py ---
#!/usr/bin/env python
#
# Time-stamp: <00/07/04 13:26:04 dhellmann>
#
# COPYRIGHT:
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of Doug
# Hellmann not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
# NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
"""Empty test file. No classes or functions defined.
"""
__rcs_info__ = {
#
# Creation Information
#
'module_name':'$RCSfile: emptytest.py,v $',
'creator':'Doug Hellmann <do...@he...>',
'project':'HappyDoc',
'created':'Sun, 21-May-2000 15:44:37 EDT',
#
# Current Information
#
'author':'$Author: doughellmann $',
'version':'$Revision: 1.1 $',
'date':'$Date: 2002/11/17 14:51:44 $',
'locker':'$Locker: $',
}
#
# Import system modules
#
#
# Import Local modules
#
#
# Module
#
--- NEW FILE: test_bug434946.py ---
#!/usr/bin/python
#
"""Carriage-returns in input text.
This file includes carriage returns with each newline for each
line.
$Id: test_bug434946.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $
"""
import string
import CommandLineApp
import os, types
import one.two
from sys import path
from token import *
from a.b import c, d
from CommandLineApp import TestApp
class DefaultClassInst:
"Class used for default parameter with a class instance."
pass
class DefaultClassInstWithParams:
"Class used for default parameter with a class instance taking parameters."
def __init__(self, *args):
"Initialize DefaultClassInstWithParams instance."
pass
class DottedBaseClass(A.B):
"Class to test subclassing from a base class with dots in the name."
pass
class MultipleBaseClasses(DefaultClassInst, DefaultClassInstWithParams,
CommandLineApp.CommandLineApp):
"Class testing multiple inheritence."
pass
# Here is a module level variable definition.
foo=1
def example_function_with_args(arg1, arg2,
arg3withDefault='hi there',
arg3aWithDefault="'hi again'",
arg3bWithDefault='"hi there again"',
arg4DefaultInt=101,
arg5DefaultTuple=(1,2),
arg6DefaultList=[3,4],
arg7DefaultNone=None,
arg8DefaultName=foo,
arg9DefaultInstance=DefaultClassInst(),
arg10DefaultInstanceWithParams= \
DefaultClassInstWithParams(1, 2,
('tuple', 'param'),
['list', 'param']
),
stringArgWithHTML='<h1>Hi, Dick & Jane!</h1>',
):
"This is an example function for testing purposes."
if one:
raise IOError('RAISE_class')
else:
raise 'RAISE_blah2'
for i in range(1, 10):
raise 'RAISE_loop'
raise 'RAISE_main_level'
return None
def example_function_without_args():
"This example function has no arguments."
pass
def example_function_with_varargs(*args):
"This example function takes a variable number of arguments."
pass
def example_function_with_kwargs(**kw):
"""
This example function takes variable keyword arguments.
"""
pass
class BaseClass1:
"First base class."
#
# classMember definition example
#
classMember=1
#
# Documentation for method_of_bc1
#
def method_of_bc1(self):
pass
def method2_of_bc1(self):
#
# Documentation for method2_of_bc1 after name
#
pass
class SubClass1(BaseClass1):
"First subclass of BaseClass1."
pass
class BaseClass2:
"Second base class."
pass
class SubClass2(BaseClass1, BaseClass2):
"Second subclass of BaseClass1 and BaseClass2."
def anotherMethod(self):
"A method not defined in the base classes."
pass
#
# Class documentation for SubClass3.
#
# This class documentation section includes a lot of text,
# in several paragraphs.
#
# See, here is another paragraph.
#
# We even have an example:
#
# a -> b -> c -> a
#
# And a bulleted list:
#
# * line one
#
# * line two
#
# * line three
#
class SubClass3(SubClass2, MultipleBaseClasses):
pass
#
# Random comment inserted in text
#
class SubClass4(SubClass1, SubClass3):
#
# Class documentation for SubClass4 after the name
#
pass
#
# External docs for five are skipped because
# of the blank line following the comment block
#
class five:
#
# internal docs for five
#
pass
class OverRecursion:
pass
class OverRecursion(OverRecursion):
pass
--- NEW FILE: test_decorated_comments.py ---
"""Test behavior with decorated comments.
$Id: test_decorated_comments.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $
Comments (not docstrings) with decorative lines consisting of only
the characters [-=# ] will be ignored.
"""
#################################################################################
#
# Func with hash lines
#
#################################################################################
def Hashes():
pass
#--------------------------------------------------------------------------------
#
# Func with dash lines
#
#--------------------------------------------------------------------------------
def Dashes():
pass
#================================================================================
#
# Func with equal lines
#
#================================================================================
def Equals():
pass
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Func with mixed dashes and equals
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def Mixed():
pass
#
# This function has, in the comments about it, a table. That table
# should be rendered via STNG to an HTML table in the test output.
#
# |-------------------------------------------------|
# | Function | Documentation |
# |=================================================|
# | '__str__' | This method converts the |
# | | the object to a string. |
# | | |
# | | - Blah |
# | | |
# | | - Blaf |
# | | |
# | | |--------------------------| |
# | | | Name | Favorite | |
# | | | | Color | |
# | | |==========================| |
# | | | Jim | Red | |
# | | |--------------------------| |
# | | | John | Blue | |
# | | |--------------------------| |
# |-------------------------------------------------|
#
def StructuredTextTable():
pass
--- NEW FILE: test_function_params.py ---
"""Test case for function argument handling with lots of different types of arguments."""
def example_function_with_args(arg1, arg2,
arg3withDefault='hi there',
arg3aWithDefault="'hi again'",
arg3bWithDefault='"hi there again"',
arg4DefaultInt=101,
arg5DefaultTuple=(1,2),
arg6DefaultList=[3,4],
arg7DefaultNone=None,
arg8DefaultName=foo,
arg9DefaultInstance=DefaultClassInst(),
arg10DefaultInstanceWithParams= \
DefaultClassInstWithParams(1, 2,
('tuple', 'param'),
['list', 'param']
),
negativeIntArg=-1,
floatArg=1.2,
negativeFloatArg=-3.4,
mathArg=1 + 2,
stringArgWithHTML='<h1>Hi, Dick & Jane!</h1>',
):
"This is an example function for testing purposes."
if one:
raise IOError('RAISE_class')
else:
raise 'RAISE_blah2'
for i in range(1, 10):
raise 'RAISE_loop'
raise 'RAISE_main_level'
return None
--- NEW FILE: test_ignore_comments.py ---
"""This module is used to test the ignore comments flag.
If the test is successful, the 'WithComments' class will not have
any documentation at all in the generated output.
"""
class WithComments:
#
# This class is documented only with comments.
#
# Any documentation which appears for this class with the
# comment flag set to ignore comments indicates a bug.
#
def __init__(self):
#
# WithComments init method.
#
# You should not see this!
#
pass
class WithoutComments:
"""This class is documented with __doc__ strings.
The documentation for this class should always appear.
"""
def __init__(self):
"""WithoutComments __init__ method.
You should see this.
"""
pass
--- NEW FILE: test_import_statements.py ---
"""Simple test file for HappyDoc.
This module contains a variety of import statements for unit testing.
"""
import CommandLineApp
from CommandLineApp import TestApp, SubClassTestApp
import Module1
from Module2 import Symbol1
import Package1.SubModule1
from Package2.SubModule2 import Symbol2
from Package3.SubModule3 import Symbol3 as Symbol3x
from a.b import c, d
import one.two
import os, types
import string
from string import strip as StringStrip
from sys import path
from token import *
from prettyast import astListFixNames
#
# Bug 478659 - Import statements with trailing comments seem to be ignored.
#
# this module will be listed
import webbrowser
import cgi # this module will not be listed
--- NEW FILE: test_nested_structures.py ---
#!/usr/bin/env python
#
# $Id: test_nested_structures.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $
#
# Time-stamp: <01/03/08 02:13:53 dhellmann>
#
# Copyright 2001 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of Doug
# Hellmann not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
# NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
"""Test various nested structures.
o Jerome Alet <al...@un...> reported that nested classes do
not appear in the output.
o Jerome Alet <al...@un...> reported that nested functions do
not appear in the output.
"""
__rcs_info__ = {
#
# Creation Information
#
'module_name' : '$RCSfile: test_nested_structures.py,v $',
'rcs_id' : '$Id: test_nested_structures.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $',
'creator' : 'Doug Hellmann <Dou...@bi...>',
'project' : 'HappyDoc',
'created' : 'Thu, 08-Mar-2001 02:08:06 EST',
#
# Current Information
#
'author' : '$Author: doughellmann $',
'version' : '$Revision: 1.1 $',
'date' : '$Date: 2002/11/17 14:51:44 $',
}
#
# Import system modules
#
#
# Import Local modules
#
#
# Module
#
class OuterClass:
"""This class is on the outside.
This class contains one nested class.
"""
class InnerClass:
"""This class is inside of OuterClass.
This class is nested one level deep.
"""
class InnerClass2:
"""This class is inside of InnerClass.
This class is nested two levels deep.
"""
def OuterFunction():
"This function is at the outer level."
def InnerFunction():
"This function is inside of OuterFunction."
def InnerFunction2():
"This function is inside of InnerFunction."
--- NEW FILE: test_variable_extraction.py ---
#!/usr/bin/env python
#
# HappyDoc:# These variables should be discovered.
# HappyDoc:TestInt=1
# HappyDoc:TestString="String"
# HappyDoc:TestStringModule=string.strip(' this has spaces in front and back ')
# HappyDoc:url=urlencode({'a':'A', 'b':'B'})
#
# $Id: test_variable_extraction.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $
#
# Copyright 2001 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of Doug
# Hellmann not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
# NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# HappyDoc:# These variables should **NOT** be discovered.
# HappyDoc:NotFound=1
"""There are HappyDoc variables embedded in the comments of this module.
"""
__rcs_info__ = {
#
# Creation Information
#
'module_name' : '$RCSfile: test_variable_extraction.py,v $',
'rcs_id' : '$Id: test_variable_extraction.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $',
'creator' : 'Doug Hellmann <Dou...@bi...>',
'project' : 'UNSPECIFIED',
'created' : 'Thu, 04-Oct-2001 10:59:20 EDT',
#
# Current Information
#
'author' : '$Author: doughellmann $',
'version' : '$Revision: 1.1 $',
'date' : '$Date: 2002/11/17 14:51:44 $',
}
try:
__version__ = __rcs_info__['version'].split(' ')[1]
except:
__version__ = '0.0'
#
# Import system modules
#
#
# Import Local modules
#
#
# Module
#
--- NEW FILE: test_variable_extraction_with_exception.py ---
#!/usr/bin/env python
#
# HappyDoc:# These variables should be discovered.
# HappyDoc:TestInt=1
# HappyDoc:TestString="String"
# HappyDoc:TestStringModule=string.strip(' this has spaces in front and back ')
# HappyDoc:url=urlencode({'a':'A', 'b':'B'})
# HappyDoc:# This should cause processing to abort.
# HappyDOc:raise RuntimeError('Raising test exception in embedded directives.')
#
# $Id: test_variable_extraction_with_exception.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $
#
# Copyright 2001 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of Doug
# Hellmann not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
# NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# HappyDoc:# These variables should **NOT** be discovered.
# HappyDoc:NotFound=1
"""There are HappyDoc variables embedded in the comments of this module.
"""
__rcs_info__ = {
#
# Creation Information
#
'module_name' : '$RCSfile: test_variable_extraction_with_exception.py,v $',
'rcs_id' : '$Id: test_variable_extraction_with_exception.py,v 1.1 2002/11/17 14:51:44 doughellmann Exp $',
'creator' : 'Doug Hellmann <Dou...@bi...>',
'project' : 'UNSPECIFIED',
'created' : 'Thu, 04-Oct-2001 10:59:20 EDT',
#
# Current Information
#
'author' : '$Author: doughellmann $',
'version' : '$Revision: 1.1 $',
'date' : '$Date: 2002/11/17 14:51:44 $',
}
try:
__version__ = __rcs_info__['version'].split(' ')[1]
except:
__version__ = '0.0'
#
# Import system modules
#
#
# Import Local modules
#
#
# Module
#
|