summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_doctesting.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/testing/tests/test_doctesting.py')
-rw-r--r--numpy/testing/tests/test_doctesting.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_doctesting.py b/numpy/testing/tests/test_doctesting.py
new file mode 100644
index 000000000..a9f790208
--- /dev/null
+++ b/numpy/testing/tests/test_doctesting.py
@@ -0,0 +1,35 @@
+""" Doctests for NumPy-specific nose/doctest modifications
+"""
+# try the #random directive on the output line
+def check_random_directive():
+ '''
+ >>> 2+2
+ <BadExample object at 0x084D05AC> #random: may vary on your system
+ '''
+
+# check the implicit "import numpy as np"
+def check_implicit_np():
+ '''
+ >>> np.array([1,2,3])
+ array([1, 2, 3])
+ '''
+
+# there's some extraneous whitespace around the correct responses
+def check_whitespace_enabled():
+ '''
+ # whitespace after the 3
+ >>> 1+2
+ 3
+
+ # whitespace before the 7
+ >>> 3+4
+ 7
+ '''
+
+
+if __name__ == '__main__':
+ # Run tests outside numpy test rig
+ import nose
+ from numpy.testing.noseclasses import NumpyDoctest
+ argv = ['', __file__, '--with-numpydoctest']
+ nose.core.TestProgram(argv=argv, addplugins=[NumpyDoctest()])