summaryrefslogtreecommitdiff
path: root/sys/lib/python/test/sample_doctest.py
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
commit458120dd40db6b4df55a4e96b650e16798ef06a0 (patch)
tree8f82685be24fef97e715c6f5ca4c68d34d5074ee /sys/lib/python/test/sample_doctest.py
parent3a742c699f6806c1145aea5149bf15de15a0afd7 (diff)
add hg and python
Diffstat (limited to 'sys/lib/python/test/sample_doctest.py')
-rw-r--r--sys/lib/python/test/sample_doctest.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/sys/lib/python/test/sample_doctest.py b/sys/lib/python/test/sample_doctest.py
new file mode 100644
index 000000000..e5adee0f6
--- /dev/null
+++ b/sys/lib/python/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()