Skip to content

Commit

Permalink
TST: add scalar tests for ttest_* functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeklant committed Apr 6, 2015
1 parent d1056ff commit 0d21f89
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scipy/stats/tests/test_stats.py
Expand Up @@ -1496,6 +1496,11 @@ class TestStudentTest(TestCase):
P2_0 = 0.2254033

def test_onesample(self):
t, p = stats.ttest_1samp(4., 3.)

assert_(np.isnan(t))
assert_(np.isnan(p))

t, p = stats.ttest_1samp(self.X1, 0)

assert_array_almost_equal(t, self.T1_0)
Expand Down Expand Up @@ -2056,6 +2061,11 @@ def test_ttest_rel():
t,p = stats.ttest_rel(rvs1_2D, rvs2_2D, axis=1)
assert_array_almost_equal([t,p],tpr)

# test scalars
t, p = stats.ttest_rel(4., 3.)
assert_(np.isnan(t))
assert_(np.isnan(p))

# test on 3 dimensions
rvs1_3D = np.dstack([rvs1_2D,rvs1_2D,rvs1_2D])
rvs2_3D = np.dstack([rvs2_2D,rvs2_2D,rvs2_2D])
Expand Down Expand Up @@ -2126,6 +2136,11 @@ def test_ttest_ind():
assert_array_almost_equal(stats.ttest_ind_from_stats(*args),
[t, p])

# test scalars
t, p = stats.ttest_ind(4., 3.)
assert_(np.isnan(t))
assert_(np.isnan(p))

# test on 3 dimensions
rvs1_3D = np.dstack([rvs1_2D,rvs1_2D,rvs1_2D])
rvs2_3D = np.dstack([rvs2_2D,rvs2_2D,rvs2_2D])
Expand Down

0 comments on commit 0d21f89

Please sign in to comment.