From df09a3feb85079eadb91a5d200494ee3de721c56 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Thu, 10 Mar 2011 10:20:11 -0700 Subject: TST: Add test for poisson exceptions. --- numpy/random/tests/test_random.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'numpy/random') diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index a4aa75380..8acb0680e 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -1,4 +1,5 @@ -from numpy.testing import TestCase, run_module_suite, assert_ +from numpy.testing import TestCase, run_module_suite, assert_,\ + assert_raises from numpy import random import numpy as np @@ -318,6 +319,14 @@ class TestRandomDist(TestCase): [0, 0]]) np.testing.assert_array_equal(actual, desired) + def test_poisson_exceptions(self): + lambig = np.iinfo('l').max + lamneg = -1 + assert_raises(ValueError, np.random.poisson, lamneg) + assert_raises(ValueError, np.random.poisson, [lamneg]*10) + assert_raises(ValueError, np.random.poisson, lambig) + assert_raises(ValueError, np.random.poisson, [lambig]*10) + def test_power(self): np.random.seed(self.seed) actual = np.random.power(a =.123456789, size = (3, 2)) -- cgit v1.2.1