annotate DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/testing/tests/test_doctesting.py @ 133:4acb5d8d80b6 tip

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