PyXR

c:\python24\lib \ test \ sample_doctest.py



0001 """This is a sample module that doesn't really test anything all that
0002    interesting.
0003 
0004 It simply has a few tests, some of which succeed and some of which fail.
0005 
0006 It's important that the numbers remain constant as another test is
0007 testing the running of these tests.
0008 
0009 
0010 >>> 2+2
0011 4
0012 """
0013 
0014 
0015 def foo():
0016     """
0017 
0018     >>> 2+2
0019     5
0020 
0021     >>> 2+2
0022     4
0023     """
0024 
0025 def bar():
0026     """
0027 
0028     >>> 2+2
0029     4
0030     """
0031 
0032 def test_silly_setup():
0033     """
0034 
0035     >>> import test.test_doctest
0036     >>> test.test_doctest.sillySetup
0037     True
0038     """
0039 
0040 def w_blank():
0041     """
0042     >>> if 1:
0043     ...    print 'a'
0044     ...    print
0045     ...    print 'b'
0046     a
0047     <BLANKLINE>
0048     b
0049     """
0050 
0051 x = 1
0052 def x_is_one():
0053     """
0054     >>> x
0055     1
0056     """
0057 
0058 def y_is_one():
0059     """
0060     >>> y
0061     1
0062     """
0063 
0064 __test__ = {'good': """
0065                     >>> 42
0066                     42
0067                     """,
0068             'bad':  """
0069                     >>> 42
0070                     666
0071                     """,
0072            }
0073 
0074 def test_suite():
0075     import doctest
0076     return doctest.DocTestSuite()
0077 

Generated by PyXR 0.9.4
SourceForge.net Logo