2004-08-06 19:02:59 -03:00
|
|
|
"""This is a sample module that doesn't really test anything all that
|
2004-08-07 02:37:52 -03:00
|
|
|
interesting.
|
2004-08-06 19:02:59 -03:00
|
|
|
|
2004-08-07 02:37:52 -03:00
|
|
|
It simply has a few tests, some of which succeed and some of which fail.
|
2004-08-06 19:02:59 -03:00
|
|
|
|
2004-08-07 02:37:52 -03:00
|
|
|
It's important that the numbers remain constant as another test is
|
2004-08-06 19:02:59 -03:00
|
|
|
testing the running of these tests.
|
|
|
|
|
|
|
|
|
|
|
|
>>> 2+2
|
|
|
|
4
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def foo():
|
|
|
|
"""
|
|
|
|
|
|
|
|
>>> 2+2
|
|
|
|
5
|
|
|
|
|
|
|
|
>>> 2+2
|
|
|
|
4
|
|
|
|
"""
|
|
|
|
|
|
|
|
def bar():
|
|
|
|
"""
|
|
|
|
|
|
|
|
>>> 2+2
|
|
|
|
4
|
|
|
|
"""
|
|
|
|
|
|
|
|
def test_silly_setup():
|
|
|
|
"""
|
|
|
|
|
|
|
|
>>> import test.test_doctest
|
|
|
|
>>> test.test_doctest.sillySetup
|
|
|
|
True
|
|
|
|
"""
|
|
|
|
|
|
|
|
def w_blank():
|
|
|
|
"""
|
|
|
|
>>> if 1:
|
2007-02-09 16:13:25 -04:00
|
|
|
... print('a')
|
|
|
|
... print()
|
|
|
|
... print('b')
|
2004-08-06 19:02:59 -03:00
|
|
|
a
|
|
|
|
<BLANKLINE>
|
|
|
|
b
|
|
|
|
"""
|
|
|
|
|
|
|
|
x = 1
|
|
|
|
def x_is_one():
|
|
|
|
"""
|
|
|
|
>>> x
|
|
|
|
1
|
|
|
|
"""
|
|
|
|
|
|
|
|
def y_is_one():
|
|
|
|
"""
|
|
|
|
>>> y
|
|
|
|
1
|
|
|
|
"""
|
|
|
|
|
2004-08-07 02:37:52 -03:00
|
|
|
__test__ = {'good': """
|
|
|
|
>>> 42
|
|
|
|
42
|
|
|
|
""",
|
|
|
|
'bad': """
|
|
|
|
>>> 42
|
|
|
|
666
|
|
|
|
""",
|
|
|
|
}
|
|
|
|
|
2004-08-06 19:02:59 -03:00
|
|
|
def test_suite():
|
|
|
|
import doctest
|
|
|
|
return doctest.DocTestSuite()
|