# [Scipy-svn] r3812 - in branches/testing_cleanup/scipy: stats testing

scipy-svn@scip... scipy-svn@scip...
Thu Jan 10 03:04:30 CST 2008

```Author: matthew.brett@gmail.com
Date: 2008-01-10 03:04:27 -0600 (Thu, 10 Jan 2008)
New Revision: 3812

Modified:
branches/testing_cleanup/scipy/stats/morestats.py
branches/testing_cleanup/scipy/testing/decorators.py
Log:
Revised nose test discovery decorator

Modified: branches/testing_cleanup/scipy/stats/morestats.py
===================================================================
--- branches/testing_cleanup/scipy/stats/morestats.py	2008-01-10 00:45:34 UTC (rev 3811)
+++ branches/testing_cleanup/scipy/stats/morestats.py	2008-01-10 09:04:27 UTC (rev 3812)
@@ -17,7 +17,7 @@
import scipy.special as special
import futil
import numpy as sb
-from scipy.testing.decorators import not_a_test
+from scipy.testing.decorators import is_nosetest

__all__ = ['find_repeats',
'bayes_mvs', 'kstat', 'kstatvar', 'probplot', 'ppcc_max', 'ppcc_plot',
@@ -770,7 +770,7 @@
pval = distributions.f.sf(W,k-1,Ntot-k) # 1 - cdf
return W, pval

-@not_a_test
+@is_nosetest(False)
def binom_test(x,n=None,p=0.5):
"""An exact (two-sided) test of the null hypothesis that the
probability of success in a Bernoulli experiment is p.

Modified: branches/testing_cleanup/scipy/testing/decorators.py
===================================================================
--- branches/testing_cleanup/scipy/testing/decorators.py	2008-01-10 00:45:34 UTC (rev 3811)
+++ branches/testing_cleanup/scipy/testing/decorators.py	2008-01-10 09:04:27 UTC (rev 3812)
@@ -27,8 +27,16 @@
t.willfail = True
return t

-def not_a_test(t):
-    ''' Signals to nose that this function is not a test
+def is_nosetest(tf):
+    ''' Signals to nose that this function is or is not a test
+
+    e.g
+    >>> @is_nosetest(False)
+    >>> def func_with_test_in_name(arg1, arg2): pass
+    ...
+    >>>
'''
-    t.__test__ = False
-    return t
+    def set_test(t):
+        t.__test__ = tf
+        return t
+    return set_test

```