diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-08-06 22:02:59 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-08-06 22:02:59 +0000 |
commit | 19397e5ec549e5281b33aa5795b517006c00f64d (patch) | |
tree | 65d1fe38b4fd47d537c45f505186666c7c7b45b2 /Lib/test/sample_doctest.py | |
parent | 98bd1814e24434ca9961dddc71bf21db67211ab9 (diff) | |
download | cpython-git-19397e5ec549e5281b33aa5795b517006c00f64d.tar.gz |
Merging from tim-doctest-branch, which is now closed.
This primarily adds more powerful ways to work with unittest, including
spiffy support for building suites out of doctests in non-Python
"text files".
Diffstat (limited to 'Lib/test/sample_doctest.py')
-rw-r--r-- | Lib/test/sample_doctest.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/Lib/test/sample_doctest.py b/Lib/test/sample_doctest.py new file mode 100644 index 0000000000..25a1d37464 --- /dev/null +++ b/Lib/test/sample_doctest.py @@ -0,0 +1,66 @@ +"""This is a sample module that doesn't really test anything all that + interesting + +It simply has a few tests, some of which suceed and some of which fail. + +It's important that the numbers remain constance, as another test is +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: + ... print 'a' + ... print + ... print 'b' + a + <BLANKLINE> + b + """ + +x = 1 +def x_is_one(): + """ + >>> x + 1 + """ + +def y_is_one(): + """ + >>> y + 1 + """ + +def test_suite(): + import doctest + return doctest.DocTestSuite() |