diff options
author | Pauli Virtanen <pav@iki.fi> | 2008-06-08 12:18:37 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2008-06-08 12:18:37 +0000 |
commit | cf89a25cebb537448707ab389f32f07dd52cf911 (patch) | |
tree | 89aa975e4b0052ab5b24d192ceeb1ee21d9761c3 | |
parent | 8fac05d6e37b6d57a08092a32c8a81768a430441 (diff) | |
download | numpy-cf89a25cebb537448707ab389f32f07dd52cf911.tar.gz |
Move umath docstrings to a separate file. Make the automatic ufunc signature compatible with the documentation standard.
-rw-r--r-- | numpy/core/code_generators/docstrings.py | 403 | ||||
-rw-r--r-- | numpy/core/code_generators/generate_umath.py | 140 | ||||
-rw-r--r-- | numpy/core/src/ufuncobject.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_umath.py | 2 |
4 files changed, 478 insertions, 69 deletions
diff --git a/numpy/core/code_generators/docstrings.py b/numpy/core/code_generators/docstrings.py new file mode 100644 index 000000000..3a85221da --- /dev/null +++ b/numpy/core/code_generators/docstrings.py @@ -0,0 +1,403 @@ +# Docstrings for generated ufuncs + +docdict = {} + +def get(name): + return docdict.get(name) + +def add_newdoc(place, name, doc): + docdict['.'.join((place, name))] = doc + + +add_newdoc('numpy.core.umath', 'absolute', + """ + Takes |x| elementwise. + + """) + +add_newdoc('numpy.core.umath', 'add', + """ + Adds the arguments elementwise. + + """) + +add_newdoc('numpy.core.umath', 'arccos', + """ + Inverse cosine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'arccosh', + """ + Inverse hyperbolic cosine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'arcsin', + """ + Inverse sine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'arcsinh', + """ + Inverse hyperbolic sine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'arctan', + """ + Inverse tangent elementwise. + + """) + +add_newdoc('numpy.core.umath', 'arctan2', + """ + A safe and correct arctan(x1/x2) + + """) + +add_newdoc('numpy.core.umath', 'arctanh', + """ + Inverse hyperbolic tangent elementwise. + + """) + +add_newdoc('numpy.core.umath', 'bitwise_and', + """ + Computes x1 & x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'bitwise_or', + """ + Computes x1 | x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'bitwise_xor', + """ + Computes x1 ^ x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'ceil', + """ + Elementwise smallest integer >= x. + + """) + +add_newdoc('numpy.core.umath', 'conjugate', + """ + Takes the conjugate of x elementwise. + + """) + +add_newdoc('numpy.core.umath', 'cos', + """ + Cosine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'cosh', + """ + Hyperbolic cosine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'degrees', + """ + Converts angle from radians to degrees + + """) + +add_newdoc('numpy.core.umath', 'divide', + """ + Divides the arguments elementwise. + + """) + +add_newdoc('numpy.core.umath', 'equal', + """ + Returns elementwise x1 == x2 in a bool array + + """) + +add_newdoc('numpy.core.umath', 'exp', + """ + e**x elementwise. + + """) + +add_newdoc('numpy.core.umath', 'expm1', + """ + e**x-1 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'fabs', + """ + Absolute values. + + """) + +add_newdoc('numpy.core.umath', 'floor', + """ + Elementwise largest integer <= x + + """) + +add_newdoc('numpy.core.umath', 'floor_divide', + """ + Floor divides the arguments elementwise. + + """) + +add_newdoc('numpy.core.umath', 'fmod', + """ + Computes (C-like) x1 % x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'greater', + """ + Returns elementwise x1 > x2 in a bool array. + + """) + +add_newdoc('numpy.core.umath', 'greater_equal', + """ + Returns elementwise x1 >= x2 in a bool array. + + """) + +add_newdoc('numpy.core.umath', 'hypot', + """ + sqrt(x1**2 + x2**2) elementwise + + """) + +add_newdoc('numpy.core.umath', 'invert', + """ + Computes ~x (bit inversion) elementwise. + + """) + +add_newdoc('numpy.core.umath', 'isfinite', + """ + Returns True where x is finite + + """) + +add_newdoc('numpy.core.umath', 'isinf', + """ + Returns True where x is +inf or -inf + + """) + +add_newdoc('numpy.core.umath', 'isnan', + """ + Returns True where x is Not-A-Number + + """) + +add_newdoc('numpy.core.umath', 'left_shift', + """ + Computes x1 << x2 (x1 shifted to left by x2 bits) elementwise. + + """) + +add_newdoc('numpy.core.umath', 'less', + """ + Returns elementwise x1 < x2 in a bool array. + + """) + +add_newdoc('numpy.core.umath', 'less_equal', + """ + Returns elementwise x1 <= x2 in a bool array + + """) + +add_newdoc('numpy.core.umath', 'log', + """ + Logarithm base e elementwise. + + """) + +add_newdoc('numpy.core.umath', 'log10', + """ + Logarithm base 10 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'log1p', + """ + log(1+x) to base e elementwise. + + """) + +add_newdoc('numpy.core.umath', 'logical_and', + """ + Returns x1 and x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'logical_not', + """ + Returns not x elementwise. + + """) + +add_newdoc('numpy.core.umath', 'logical_or', + """ + Returns x1 or x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'logical_xor', + """ + Returns x1 xor x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'maximum', + """ + Returns maximum (if x1 > x2: x1; else: x2) elementwise. + + """) + +add_newdoc('numpy.core.umath', 'minimum', + """ + Returns minimum (if x1 < x2: x1; else: x2) elementwise + + """) + +add_newdoc('numpy.core.umath', 'modf', + """ + Breaks x into fractional (y1) and integral (y2) parts. + + Each output has the same sign as the input. + + """) + +add_newdoc('numpy.core.umath', 'multiply', + """ + Multiplies the arguments elementwise. + + """) + +add_newdoc('numpy.core.umath', 'negative', + """ + Determines -x elementwise + + """) + +add_newdoc('numpy.core.umath', 'not_equal', + """ + Returns elementwise x1 |= x2 + + """) + +add_newdoc('numpy.core.umath', 'ones_like', + """ + Returns an array of ones of the shape and typecode of x. + + """) + +add_newdoc('numpy.core.umath', 'power', + """ + Computes x1**x2 elementwise. + + """) + +add_newdoc('numpy.core.umath', 'radians', + """ + Converts angle from degrees to radians + + """) + +add_newdoc('numpy.core.umath', 'reciprocal', + """ + Compute 1/x + + """) + +add_newdoc('numpy.core.umath', 'remainder', + """ + Computes x1-n*x2 where n is floor(x1 / x2) + + """) + +add_newdoc('numpy.core.umath', 'right_shift', + """ + Computes x1 >> x2 (x1 shifted to right by x2 bits) elementwise. + + """) + +add_newdoc('numpy.core.umath', 'rint', + """ + Round x elementwise to the nearest integer, round halfway cases away from zero + + """) + +add_newdoc('numpy.core.umath', 'sign', + """ + Returns -1 if x < 0 and 0 if x==0 and 1 if x > 0 + + """) + +add_newdoc('numpy.core.umath', 'signbit', + """ + Returns True where signbit of x is set (x<0). + + """) + +add_newdoc('numpy.core.umath', 'sin', + """ + Sine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'sinh', + """ + Hyperbolic sine elementwise. + + """) + +add_newdoc('numpy.core.umath', 'sqrt', + """ + Square-root elementwise. For real x, the domain is restricted to x>=0. + + """) + +add_newdoc('numpy.core.umath', 'square', + """ + Compute x**2. + + """) + +add_newdoc('numpy.core.umath', 'subtract', + """ + Subtracts the arguments elementwise. + + """) + +add_newdoc('numpy.core.umath', 'tan', + """ + Tangent elementwise. + + """) + +add_newdoc('numpy.core.umath', 'tanh', + """ + Hyperbolic tangent elementwise. + + """) + +add_newdoc('numpy.core.umath', 'true_divide', + """ + True divides the arguments elementwise. + + """) + diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py index 98fc2ec06..4fe24fae2 100644 --- a/numpy/core/code_generators/generate_umath.py +++ b/numpy/core/code_generators/generate_umath.py @@ -1,4 +1,8 @@ -import re +import re, textwrap +import sys, os +sys.path.insert(0, os.path.dirname(__file__)) +import docstrings +sys.path.pop(0) Zero = "PyUFunc_Zero" One = "PyUFunc_One" @@ -153,37 +157,37 @@ noobj = all[:-1] defdict = { 'add' : Ufunc(2, 1, Zero, - 'adds the arguments elementwise.', + docstrings.get('numpy.core.umath.add'), TD(noobj), TD(O, f='PyNumber_Add'), ), 'subtract' : Ufunc(2, 1, Zero, - 'subtracts the arguments elementwise.', + docstrings.get('numpy.core.umath.subtract'), TD(noobj), TD(O, f='PyNumber_Subtract'), ), 'multiply' : Ufunc(2, 1, One, - 'multiplies the arguments elementwise.', + docstrings.get('numpy.core.umath.multiply'), TD(noobj), TD(O, f='PyNumber_Multiply'), ), 'divide' : Ufunc(2, 1, One, - 'divides the arguments elementwise.', + docstrings.get('numpy.core.umath.divide'), TD(intfltcmplx), TD(O, f='PyNumber_Divide'), ), 'floor_divide' : Ufunc(2, 1, One, - 'floor divides the arguments elementwise.', + docstrings.get('numpy.core.umath.floor_divide'), TD(intfltcmplx), TD(O, f='PyNumber_FloorDivide'), ), 'true_divide' : Ufunc(2, 1, One, - 'true divides the arguments elementwise.', + docstrings.get('numpy.core.umath.true_divide'), TD('bBhH', out='f'), TD('iIlLqQ', out='d'), TD(flts+cmplx), @@ -191,346 +195,346 @@ defdict = { ), 'conjugate' : Ufunc(1, 1, None, - 'takes the conjugate of x elementwise.', + docstrings.get('numpy.core.umath.conjugate'), TD(nobool_or_obj), TD(M, f='conjugate'), ), 'fmod' : Ufunc(2, 1, Zero, - 'computes (C-like) x1 % x2 elementwise.', + docstrings.get('numpy.core.umath.fmod'), TD(ints), TD(flts, f='fmod'), TD(M, f='fmod'), ), 'square' : Ufunc(1, 1, None, - 'compute x**2.', + docstrings.get('numpy.core.umath.square'), TD(nobool_or_obj), TD(O, f='Py_square'), ), 'reciprocal' : Ufunc(1, 1, None, - 'compute 1/x', + docstrings.get('numpy.core.umath.reciprocal'), TD(nobool_or_obj), TD(O, f='Py_reciprocal'), ), 'ones_like' : Ufunc(1, 1, None, - 'returns an array of ones of the shape and typecode of x.', + docstrings.get('numpy.core.umath.ones_like'), TD(nobool_or_obj), TD(O, f='Py_get_one'), ), 'power' : Ufunc(2, 1, One, - 'computes x1**x2 elementwise.', + docstrings.get('numpy.core.umath.power'), TD(ints), TD(inexact, f='pow'), TD(O, f='PyNumber_Power'), ), 'absolute' : Ufunc(1, 1, None, - 'takes |x| elementwise.', + docstrings.get('numpy.core.umath.absolute'), TD(nocmplx), TD(cmplx, out=('f', 'd', 'g')), TD(O, f='PyNumber_Absolute'), ), 'negative' : Ufunc(1, 1, None, - 'determines -x elementwise', + docstrings.get('numpy.core.umath.negative'), TD(nocmplx), TD(cmplx, f='neg'), TD(O, f='PyNumber_Negative'), ), 'sign' : Ufunc(1, 1, None, - 'returns -1 if x < 0 and 0 if x==0 and 1 if x > 0', + docstrings.get('numpy.core.umath.sign'), TD(nobool), ), 'greater' : Ufunc(2, 1, None, - 'returns elementwise x1 > x2 in a bool array.', + docstrings.get('numpy.core.umath.greater'), TD(all, out='?'), ), 'greater_equal' : Ufunc(2, 1, None, - 'returns elementwise x1 >= x2 in a bool array.', + docstrings.get('numpy.core.umath.greater_equal'), TD(all, out='?'), ), 'less' : Ufunc(2, 1, None, - 'returns elementwise x1 < x2 in a bool array.', + docstrings.get('numpy.core.umath.less'), TD(all, out='?'), ), 'less_equal' : Ufunc(2, 1, None, - 'returns elementwise x1 <= x2 in a bool array', + docstrings.get('numpy.core.umath.less_equal'), TD(all, out='?'), ), 'equal' : Ufunc(2, 1, None, - 'returns elementwise x1 == x2 in a bool array', + docstrings.get('numpy.core.umath.equal'), TD(all, out='?'), ), 'not_equal' : Ufunc(2, 1, None, - 'returns elementwise x1 |= x2', + docstrings.get('numpy.core.umath.not_equal'), TD(all, out='?'), ), 'logical_and' : Ufunc(2, 1, One, - 'returns x1 and x2 elementwise.', + docstrings.get('numpy.core.umath.logical_and'), TD(noobj, out='?'), TD(M, f='logical_and'), ), 'logical_not' : Ufunc(1, 1, None, - 'returns not x elementwise.', + docstrings.get('numpy.core.umath.logical_not'), TD(noobj, out='?'), TD(M, f='logical_not'), ), 'logical_or' : Ufunc(2, 1, Zero, - 'returns x1 or x2 elementwise.', + docstrings.get('numpy.core.umath.logical_or'), TD(noobj, out='?'), TD(M, f='logical_or'), ), 'logical_xor' : Ufunc(2, 1, None, - 'returns x1 xor x2 elementwise.', + docstrings.get('numpy.core.umath.logical_xor'), TD(noobj, out='?'), TD(M, f='logical_xor'), ), 'maximum' : Ufunc(2, 1, None, - 'returns maximum (if x1 > x2: x1; else: x2) elementwise.', + docstrings.get('numpy.core.umath.maximum'), TD(noobj), TD(O, f='_npy_ObjectMax') ), 'minimum' : Ufunc(2, 1, None, - 'returns minimum (if x1 < x2: x1; else: x2) elementwise', + docstrings.get('numpy.core.umath.minimum'), TD(noobj), TD(O, f='_npy_ObjectMin') ), 'bitwise_and' : Ufunc(2, 1, One, - 'computes x1 & x2 elementwise.', + docstrings.get('numpy.core.umath.bitwise_and'), TD(bints), TD(O, f='PyNumber_And'), ), 'bitwise_or' : Ufunc(2, 1, Zero, - 'computes x1 | x2 elementwise.', + docstrings.get('numpy.core.umath.bitwise_or'), TD(bints), TD(O, f='PyNumber_Or'), ), 'bitwise_xor' : Ufunc(2, 1, None, - 'computes x1 ^ x2 elementwise.', + docstrings.get('numpy.core.umath.bitwise_xor'), TD(bints), TD(O, f='PyNumber_Xor'), ), 'invert' : Ufunc(1, 1, None, - 'computes ~x (bit inversion) elementwise.', + docstrings.get('numpy.core.umath.invert'), TD(bints), TD(O, f='PyNumber_Invert'), ), 'left_shift' : Ufunc(2, 1, None, - 'computes x1 << x2 (x1 shifted to left by x2 bits) elementwise.', + docstrings.get('numpy.core.umath.left_shift'), TD(ints), TD(O, f='PyNumber_Lshift'), ), 'right_shift' : Ufunc(2, 1, None, - 'computes x1 >> x2 (x1 shifted to right by x2 bits) elementwise.', + docstrings.get('numpy.core.umath.right_shift'), TD(ints), TD(O, f='PyNumber_Rshift'), ), 'degrees' : Ufunc(1, 1, None, - 'converts angle from radians to degrees', + docstrings.get('numpy.core.umath.degrees'), TD(fltsM, f='degrees'), ), 'radians' : Ufunc(1, 1, None, - 'converts angle from degrees to radians', + docstrings.get('numpy.core.umath.radians'), TD(fltsM, f='radians'), ), 'arccos' : Ufunc(1, 1, None, - 'inverse cosine elementwise.', + docstrings.get('numpy.core.umath.arccos'), TD(inexact, f='acos'), TD(M, f='arccos'), ), 'arccosh' : Ufunc(1, 1, None, - 'inverse hyperbolic cosine elementwise.', + docstrings.get('numpy.core.umath.arccosh'), TD(inexact, f='acosh'), TD(M, f='arccosh'), ), 'arcsin' : Ufunc(1, 1, None, - 'inverse sine elementwise.', + docstrings.get('numpy.core.umath.arcsin'), TD(inexact, f='asin'), TD(M, f='arcsin'), ), 'arcsinh' : Ufunc(1, 1, None, - 'inverse hyperbolic sine elementwise.', + docstrings.get('numpy.core.umath.arcsinh'), TD(inexact, f='asinh'), TD(M, f='arcsinh'), ), 'arctan' : Ufunc(1, 1, None, - 'inverse tangent elementwise.', + docstrings.get('numpy.core.umath.arctan'), TD(inexact, f='atan'), TD(M, f='arctan'), ), 'arctanh' : Ufunc(1, 1, None, - 'inverse hyperbolic tangent elementwise.', + docstrings.get('numpy.core.umath.arctanh'), TD(inexact, f='atanh'), TD(M, f='arctanh'), ), 'cos' : Ufunc(1, 1, None, - 'cosine elementwise.', + docstrings.get('numpy.core.umath.cos'), TD(inexact, f='cos'), TD(M, f='cos'), ), 'sin' : Ufunc(1, 1, None, - 'sine elementwise.', + docstrings.get('numpy.core.umath.sin'), TD(inexact, f='sin'), TD(M, f='sin'), ), 'tan' : Ufunc(1, 1, None, - 'tangent elementwise.', + docstrings.get('numpy.core.umath.tan'), TD(inexact, f='tan'), TD(M, f='tan'), ), 'cosh' : Ufunc(1, 1, None, - 'hyperbolic cosine elementwise.', + docstrings.get('numpy.core.umath.cosh'), TD(inexact, f='cosh'), TD(M, f='cosh'), ), 'sinh' : Ufunc(1, 1, None, - 'hyperbolic sine elementwise.', + docstrings.get('numpy.core.umath.sinh'), TD(inexact, f='sinh'), TD(M, f='sinh'), ), 'tanh' : Ufunc(1, 1, None, - 'hyperbolic tangent elementwise.', + docstrings.get('numpy.core.umath.tanh'), TD(inexact, f='tanh'), TD(M, f='tanh'), ), 'exp' : Ufunc(1, 1, None, - 'e**x elementwise.', + docstrings.get('numpy.core.umath.exp'), TD(inexact, f='exp'), TD(M, f='exp'), ), 'expm1' : Ufunc(1, 1, None, - 'e**x-1 elementwise.', + docstrings.get('numpy.core.umath.expm1'), TD(inexact, f='expm1'), TD(M, f='expm1'), ), 'log' : Ufunc(1, 1, None, - 'logarithm base e elementwise.', + docstrings.get('numpy.core.umath.log'), TD(inexact, f='log'), TD(M, f='log'), ), 'log10' : Ufunc(1, 1, None, - 'logarithm base 10 elementwise.', + docstrings.get('numpy.core.umath.log10'), TD(inexact, f='log10'), TD(M, f='log10'), ), 'log1p' : Ufunc(1, 1, None, - 'log(1+x) to base e elementwise.', + docstrings.get('numpy.core.umath.log1p'), TD(inexact, f='log1p'), TD(M, f='log1p'), ), 'sqrt' : Ufunc(1, 1, None, - 'square-root elementwise. For real x, the domain is restricted to x>=0.', + docstrings.get('numpy.core.umath.sqrt'), TD(inexact, f='sqrt'), TD(M, f='sqrt'), ), 'ceil' : Ufunc(1, 1, None, - 'elementwise smallest integer >= x.', + docstrings.get('numpy.core.umath.ceil'), TD(flts, f='ceil'), TD(M, f='ceil'), ), 'fabs' : Ufunc(1, 1, None, - 'absolute values.', + docstrings.get('numpy.core.umath.fabs'), TD(flts, f='fabs'), TD(M, f='fabs'), ), 'floor' : Ufunc(1, 1, None, - 'elementwise largest integer <= x', + docstrings.get('numpy.core.umath.floor'), TD(flts, f='floor'), TD(M, f='floor'), ), 'rint' : Ufunc(1, 1, None, - 'round x elementwise to the nearest integer, round halfway cases away from zero', + docstrings.get('numpy.core.umath.rint'), TD(inexact, f='rint'), TD(M, f='rint'), ), 'arctan2' : Ufunc(2, 1, None, - 'a safe and correct arctan(x1/x2)', + docstrings.get('numpy.core.umath.arctan2'), TD(flts, f='atan2'), TD(M, f='arctan2'), ), 'remainder' : Ufunc(2, 1, None, - 'computes x1-n*x2 where n is floor(x1 / x2)', + docstrings.get('numpy.core.umath.remainder'), TD(intflt), TD(O, f='PyNumber_Remainder'), ), 'hypot' : Ufunc(2, 1, None, - 'sqrt(x1**2 + x2**2) elementwise', + docstrings.get('numpy.core.umath.hypot'), TD(flts, f='hypot'), TD(M, f='hypot'), ), 'isnan' : Ufunc(1, 1, None, - 'returns True where x is Not-A-Number', + docstrings.get('numpy.core.umath.isnan'), TD(inexact, out='?'), ), 'isinf' : Ufunc(1, 1, None, - 'returns True where x is +inf or -inf', + docstrings.get('numpy.core.umath.isinf'), TD(inexact, out='?'), ), 'isfinite' : Ufunc(1, 1, None, - 'returns True where x is finite', + docstrings.get('numpy.core.umath.isfinite'), TD(inexact, out='?'), ), 'signbit' : Ufunc(1, 1, None, - 'returns True where signbit of x is set (x<0).', + docstrings.get('numpy.core.umath.signbit'), TD(flts, out='?'), ), 'modf' : Ufunc(1, 2, None, - 'breaks x into fractional (y1) and integral (y2) parts.\\n\\n Each output has the same sign as the input.', + docstrings.get('numpy.core.umath.modf'), TD(flts), ), } @@ -667,6 +671,8 @@ def make_ufuncs(funcdict): for name in names: uf = funcdict[name] mlist = [] + docstring = textwrap.dedent(uf.docstring).strip() + docstring = docstring.encode('string-escape').replace(r'"', r'\"') mlist.append(\ r"""f = PyUFunc_FromFuncAndData(%s_functions, %s_data, %s_signatures, %d, %d, %d, %s, "%s", @@ -674,7 +680,7 @@ r"""f = PyUFunc_FromFuncAndData(%s_functions, %s_data, %s_signatures, %d, len(uf.type_descriptions), uf.nin, uf.nout, uf.identity, - name, uf.docstring)) + name, docstring)) mlist.append(r"""PyDict_SetItemString(dictionary, "%s", f);""" % name) mlist.append(r"""Py_DECREF(f);""") code3list.append('\n'.join(mlist)) diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c index b07e693f2..d07f78305 100644 --- a/numpy/core/src/ufuncobject.c +++ b/numpy/core/src/ufuncobject.c @@ -4007,7 +4007,7 @@ ufunc_get_doc(PyUFuncObject *self) PyObject *outargs, *inargs, *doc; outargs = _makeargs(self->nout, "y"); inargs = _makeargs(self->nin, "x"); - doc = PyString_FromFormat("%s = %s(%s) %s", + doc = PyString_FromFormat("%s = %s(%s)\n\n%s", PyString_AS_STRING(outargs), self->name, PyString_AS_STRING(inargs), diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 353305d47..0d0e8840e 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -211,7 +211,7 @@ class TestChoose(NumpyTestCase): def check_attributes(self): add = ncu.add assert_equal(add.__name__, 'add') - assert_equal(add.__doc__, 'y = add(x1,x2) adds the arguments elementwise.') + assert add.__doc__.startswith('y = add(x1,x2)\n\n') self.failUnless(add.ntypes >= 18) # don't fail if types added self.failUnless('ii->i' in add.types) assert_equal(add.nin, 2) |