Repository: scipy/scipy
File: scipy/stats/tests/test_axis_nan_policy.py (Python)

Code before:
    (stats.combine_pvalues, tuple(), {}, 1, 2, False, None),
    (stats.lmoment, tuple(), dict(), 1, 4, False, lambda x: tuple(x)),
    (combine_pvalues_weighted, tuple(), {}, 2, 2, True, None),
    (xp_mean_1samp, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (xp_mean_2samp, tuple(), dict(), 2, 1, True, lambda x: (x,)),
    (xp_var, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (stats.chatterjeexi, tuple(), dict(), 2, 2, True,
     lambda res: (res.statistic, res.pvalue)),
    (stats.spearmanrho, tuple(), dict(), 2, 2, True,
     lambda res: (res.statistic, res.pvalue)),
    (stats.pointbiserialr, tuple(), dict(), 2, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (stats.kendalltau, tuple(), dict(), 2, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (stats.weightedtau, tuple(), dict(), 2, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (weightedtau_weighted, tuple(), dict(), 3, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (stats.linregress, tuple(), dict(), 2, 6, True,
     lambda res: tuple(res) + (res.intercept_stderr,)),
    (stats.theilslopes, tuple(), dict(), 2, 4, True, tuple),
    (stats.theilslopes, tuple(), dict(), 1, 4, True, tuple),
    (stats.siegelslopes, tuple(), dict(), 2, 2, True, tuple),
    (stats.siegelslopes, tuple(), dict(), 1, 2, True, tuple),
    (gstd, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (stats.power_divergence, tuple(), dict(), 1, 2, False, None),
    (stats.chisquare, tuple(), dict(), 1, 2, False, None),
    (stats.median_abs_deviation, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (boxcox_llf, tuple(), dict(lmb=1.5), 1, 1, False, lambda x: (x,)),
    (yeojohnson_llf, tuple(), dict(lmb=1.5), 1, 1, False, lambda x: (x,)),
    (stats.expectile, (0.4,), dict(), 1, 1, False, lambda x: (x,)),
]

# If the message is one of those expected, put nans in
# appropriate places of `statistics` and `pvalues`
too_small_messages = {"Degrees of freedom <= 0 for slice",
                      "x and y should have at least 5 elements",
                      "Data must be at least length 3",
                      "The sample must contain at least two",
                      "x and y must contain at least two",
                      "division by zero",
                      "Mean of empty slice",
                      "Data passed to ks_2samp must not be empty",
                      "Not enough test observations",
                      "Not enough other observations",
                      "Not enough observations.",
                      "At least one observation is required",
                      "zero-size array to reduction operation maximum",
                      "`x` and `y` must be of nonzero size.",
                      "The exact distribution of the Wilcoxon test",
                      "Data input must not be empty",

Review comment (suggestion):
There was actually a mistake in `theilslopes` with N-D input and `method='joint'`, corrected above. Test that it's fixed!

Code after:
    (stats.combine_pvalues, tuple(), {}, 1, 2, False, None),
    (stats.lmoment, tuple(), dict(), 1, 4, False, lambda x: tuple(x)),
    (combine_pvalues_weighted, tuple(), {}, 2, 2, True, None),
    (xp_mean_1samp, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (xp_mean_2samp, tuple(), dict(), 2, 1, True, lambda x: (x,)),
    (xp_var, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (stats.chatterjeexi, tuple(), dict(), 2, 2, True,
     lambda res: (res.statistic, res.pvalue)),
    (stats.spearmanrho, tuple(), dict(), 2, 2, True,
     lambda res: (res.statistic, res.pvalue)),
    (stats.pointbiserialr, tuple(), dict(), 2, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (stats.kendalltau, tuple(), dict(), 2, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (stats.weightedtau, tuple(), dict(), 2, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (weightedtau_weighted, tuple(), dict(), 3, 3, True,
     lambda res: (res.statistic, res.pvalue, res.correlation)),
    (stats.linregress, tuple(), dict(), 2, 6, True,
     lambda res: tuple(res) + (res.intercept_stderr,)),
    (stats.theilslopes, tuple(), dict(), 2, 4, True, tuple),
    (stats.theilslopes, tuple(), dict(), 1, 4, True, tuple),
    (stats.theilslopes, tuple(), dict(method='joint'), 2, 4, True, tuple),
    (stats.siegelslopes, tuple(), dict(), 2, 2, True, tuple),
    (stats.siegelslopes, tuple(), dict(), 1, 2, True, tuple),
    (stats.siegelslopes, tuple(), dict(method='hierarchical'), 2, 2, True, tuple),
    (gstd, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (stats.power_divergence, tuple(), dict(), 1, 2, False, None),
    (stats.chisquare, tuple(), dict(), 1, 2, False, None),
    (stats.median_abs_deviation, tuple(), dict(), 1, 1, False, lambda x: (x,)),
    (boxcox_llf, tuple(), dict(lmb=1.5), 1, 1, False, lambda x: (x,)),
    (yeojohnson_llf, tuple(), dict(lmb=1.5), 1, 1, False, lambda x: (x,)),
    (stats.expectile, (0.4,), dict(), 1, 1, False, lambda x: (x,)),
]

# If the message is one of those expected, put nans in
# appropriate places of `statistics` and `pvalues`
too_small_messages = {"Degrees of freedom <= 0 for slice",
                      "x and y should have at least 5 elements",
                      "Data must be at least length 3",
                      "The sample must contain at least two",
                      "x and y must contain at least two",
                      "division by zero",
                      "Mean of empty slice",
                      "Data passed to ks_2samp must not be empty",
                      "Not enough test observations",
                      "Not enough other observations",
                      "Not enough observations.",
                      "At least one observation is required",
                      "zero-size array to reduction operation maximum",
                      "`x` and `y` must be of nonzero size.",