Permalink
Browse files

BUG: stats: The method _construct_default_doc did not properly handle…

… the default value of the extradoc keyword (ticket #1316).
  • Loading branch information...
1 parent 33cccf6 commit 44ca4c15ddd49a31bf1801a6a81291d2916a3bba warren.weckesser committed Oct 19, 2010
Showing with 11 additions and 0 deletions.
  1. +4 −0 scipy/stats/distributions.py
  2. +7 −0 scipy/stats/tests/test_distributions.py
View
4 scipy/stats/distributions.py
@@ -971,6 +971,10 @@ def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0,
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,
View
7 scipy/stats/tests/test_distributions.py
@@ -556,5 +556,12 @@ def test_regression_02(self):
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()

0 comments on commit 44ca4c1

Please sign in to comment.