Permalink
Browse files

Tests cleaned up, mostly work

  • Loading branch information...
1 parent 28f1979 commit 25898a2f5945819d53bb6f847e78bfe0540b4d6b @mrocklin committed Aug 4, 2011
Showing with 6 additions and 4 deletions.
  1. +4 −4 sympy/statistics/tests/test_continuous_rv.py
  2. +2 −0 sympy/statistics/tests/test_finite_rv.py
@@ -10,7 +10,7 @@ def test_single_normal():
X = Normal(0,1)
Y = X*sigma + mu
- assert E(Y) == mu
+ assert simplify(E(Y)) == mu
assert simplify(var(Y)) == sigma**2
x, pdf = Density(Y)
assert pdf == 2**S.Half*exp(-(x - mu)**2/(2*sigma**2))/(2*pi**S.Half*sigma)
@@ -58,7 +58,7 @@ def test_multiple_normal():
def test_symbolic():
mu1, mu2 = symbols('mu1 mu2', real=True, finite=True, bounded=True)
- s1, s2 = symbols('sigma1 sigma2', real=True, finite=True, possitive=True)
+ s1, s2 = symbols('sigma1 sigma2', real=True, finite=True, positive=True)
rate = Symbol('lambda', real=True, positive=True, bounded=True)
X = Normal(mu1, s1)
Y = Normal(mu2, s2)
@@ -69,10 +69,10 @@ def test_symbolic():
assert E(X+Y) == mu1+mu2
assert E(a*X+b) == a*E(X)+b
assert var(X) == s1**2
- assert var(X+a*Y+b) == var(X) + a*var(Y)
+ assert simplify(var(X+a*Y+b)) == var(X) + a**2*var(Y)
assert E(Z) == 1/rate
- assert E(a*Z+b) == a*E(Z)+B
+ assert E(a*Z+b) == a*E(Z)+b
assert E(X+a*Z+b) == mu1 + a/rate + b
@@ -46,6 +46,8 @@ def test_dice():
assert pspace(X).domain.as_boolean() == Or(
*[Eq(X.symbol, i) for i in [1,2,3,4,5,6]])
+ assert Where(X>3).set == FiniteSet(4,5,6)
+
def test_domains():
x, y = symbols('x y')
X, Y= Die(6, symbol=x), Die(6, symbol=y)

0 comments on commit 25898a2

Please sign in to comment.