[Scipy-svn] r6848 - in trunk/scipy/stats: . tests

scipy-svn@scip... scipy-svn@scip...
Tue Oct 19 11:20:43 CDT 2010


Author: warren.weckesser
Date: 2010-10-19 11:20:43 -0500 (Tue, 19 Oct 2010)
New Revision: 6848

Modified:
   trunk/scipy/stats/distributions.py
   trunk/scipy/stats/tests/test_distributions.py
Log:
BUG: stats: The method _construct_default_doc did not properly handle the default value of the extradoc keyword (ticket #1316).

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2010-10-19 13:31:17 UTC (rev 6847)
+++ trunk/scipy/stats/distributions.py	2010-10-19 16:20:43 UTC (rev 6848)
@@ -971,6 +971,10 @@
 
     def _construct_default_doc(self, longname=None, extradoc=None):
         """Construct instance docstring from the default template."""
+        if longname is None:
+            longname = 'A'
+        if extradoc is None:
+            extradoc = ''
         if extradoc.startswith('\n\n'):
             extradoc = extradoc[2:]
         self.__doc__ = ''.join(['%s continuous random variable.'%longname,

Modified: trunk/scipy/stats/tests/test_distributions.py
===================================================================
--- trunk/scipy/stats/tests/test_distributions.py	2010-10-19 13:31:17 UTC (rev 6847)
+++ trunk/scipy/stats/tests/test_distributions.py	2010-10-19 16:20:43 UTC (rev 6848)
@@ -556,5 +556,12 @@
         assert_equal(m1, m2)
 
 
+def test_regression_ticket_1316():
+    """Regression test for ticket #1316."""
+    # The following was raising an exception, because _construct_default_doc()
+    # did not handle the default keyword extradoc=None.  See ticket #1316.
+    g = stats.distributions.gamma_gen(name='gamma')
+
+
 if __name__ == "__main__":
     run_module_suite()



More information about the Scipy-svn mailing list