Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/testing/tests/test_doctesting.py @ 87:2a2c65a20a8b
Add Python libs and headers
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2015 14:05:22 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
86:413a9d26189e | 87:2a2c65a20a8b |
---|---|
1 """ Doctests for NumPy-specific nose/doctest modifications | |
2 | |
3 """ | |
4 from __future__ import division, absolute_import, print_function | |
5 | |
6 # try the #random directive on the output line | |
7 def check_random_directive(): | |
8 ''' | |
9 >>> 2+2 | |
10 <BadExample object at 0x084D05AC> #random: may vary on your system | |
11 ''' | |
12 | |
13 # check the implicit "import numpy as np" | |
14 def check_implicit_np(): | |
15 ''' | |
16 >>> np.array([1,2,3]) | |
17 array([1, 2, 3]) | |
18 ''' | |
19 | |
20 # there's some extraneous whitespace around the correct responses | |
21 def check_whitespace_enabled(): | |
22 ''' | |
23 # whitespace after the 3 | |
24 >>> 1+2 | |
25 3 | |
26 | |
27 # whitespace before the 7 | |
28 >>> 3+4 | |
29 7 | |
30 ''' | |
31 | |
32 def check_empty_output(): | |
33 """ Check that no output does not cause an error. | |
34 | |
35 This is related to nose bug 445; the numpy plugin changed the | |
36 doctest-result-variable default and therefore hit this bug: | |
37 http://code.google.com/p/python-nose/issues/detail?id=445 | |
38 | |
39 >>> a = 10 | |
40 """ | |
41 | |
42 def check_skip(): | |
43 """ Check skip directive | |
44 | |
45 The test below should not run | |
46 | |
47 >>> 1/0 #doctest: +SKIP | |
48 """ | |
49 | |
50 | |
51 if __name__ == '__main__': | |
52 # Run tests outside numpy test rig | |
53 import nose | |
54 from numpy.testing.noseclasses import NumpyDoctest | |
55 argv = ['', __file__, '--with-numpydoctest'] | |
56 nose.core.TestProgram(argv=argv, addplugins=[NumpyDoctest()]) |