summaryrefslogtreecommitdiff
path: root/src/python/stdlib/test/sample_doctest.py
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2011-03-22 17:58:52 (GMT)
committer Simon <simon@hardwired.org.uk>2011-03-22 17:58:52 (GMT)
commit2e401babb793238564ca640fc802a52ab7f6c293 (patch)
tree87a9b471e82604e76f96d556f5771322fb31818a /src/python/stdlib/test/sample_doctest.py
parentc096b2b14a200a0cc0a08cfea839c9e7f4edf22e (diff)
parent04a9cbcb8855e64db660a8c6e23d79114b4afd83 (diff)
downloadpowder-2e401babb793238564ca640fc802a52ab7f6c293.zip
powder-2e401babb793238564ca640fc802a52ab7f6c293.tar.gz
Python console
Diffstat (limited to 'src/python/stdlib/test/sample_doctest.py')
-rw-r--r--src/python/stdlib/test/sample_doctest.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/python/stdlib/test/sample_doctest.py b/src/python/stdlib/test/sample_doctest.py
new file mode 100644
index 0000000..e5adee0
--- /dev/null
+++ b/src/python/stdlib/test/sample_doctest.py
@@ -0,0 +1,76 @@
+"""This is a sample module that doesn't really test anything all that
+ interesting.
+
+It simply has a few tests, some of which succeed and some of which fail.
+
+It's important that the numbers remain constant 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
+ """
+
+__test__ = {'good': """
+ >>> 42
+ 42
+ """,
+ 'bad': """
+ >>> 42
+ 666
+ """,
+ }
+
+def test_suite():
+ import doctest
+ return doctest.DocTestSuite()