[SciPy-Dev] adding test to test_random.py
Vincent Davis
vincent at vincentdavis.net
Sun Jun 13 19:59:50 EDT 2010
I was thinking that I could add a test to test_random.py withing numpy
to test rand(), randn()..
I added a few tests and modified/saved it to my currently install
numpy. The test should fail but I get no failed tests. I guess there
is something I don't know :)
I added (assert 1==2 #just to make sure it fails :) but the randn
test should also fail.
class TestRandomDist(TestCase):
""" Make sure the random distrobution return the correct value for a
given seed
"""
self.seed = 1234567890
def test_rand(self):
np.random.seed(self.seed)
actual = np.random.rand(3,3)
desired = array([[ 0.61879477, 0.59162363, 0.88868359],
[ 0.8916548 , 0.45756748, 0.77818808],
[ 0.26706377, 0.99610621, 0.54009489]])
assert actual == desired
assert 1==2
def test_randn(self):
np.random.seed(self.seed)
actual = np.random.randn(3,3)
desired = array([[ 1.34016346, 1.73759123, 1.49898834],
[-0.22864333, 2.031034 , 2.17032495],
[ 1.59645265, -0.76945156, 0.56605824]])
assert actual == desired
More information about the SciPy-Dev
mailing list