summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorMatthew Brett <matthew.brett@gmail.com>2011-08-15 12:38:13 -0700
committerCharles Harris <charlesr.harris@gmail.com>2011-08-16 10:44:29 -0600
commit199535c5c34360be7238c80b25d810abce62e6e4 (patch)
tree7db338d5f06473be9ec4260985981d90b40cd521 /numpy
parent8eba1efb4599adfcca6c08d041cfca3111f064db (diff)
downloadnumpy-199535c5c34360be7238c80b25d810abce62e6e4.tar.gz
ENH: move doctest tests to own file with ifmain
The doctesting tests were in the code file, and (for me) rather difficult to run without running lots of other tests. With this change you can run the doctest tests in isolation by executing the test_doctesting.py file.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/testing/nosetester.py29
-rw-r--r--numpy/testing/tests/test_doctesting.py35
2 files changed, 35 insertions, 29 deletions
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py
index c6bd9a110..4d716ca25 100644
--- a/numpy/testing/nosetester.py
+++ b/numpy/testing/nosetester.py
@@ -401,32 +401,3 @@ class NoseTester(object):
return nose.run(argv=argv, addplugins=add_plugins)
-
-########################################################################
-# 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
- '''
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()])