summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2011-03-10 10:20:11 -0700
committerCharles Harris <charlesr.harris@gmail.com>2011-03-10 10:23:43 -0700
commitdf09a3feb85079eadb91a5d200494ee3de721c56 (patch)
treed40cca20fc4987b1abf247175d632195d505c5b6 /numpy
parent8cd4faaa0ec7b35b804633bacbbd959180309efe (diff)
downloadnumpy-df09a3feb85079eadb91a5d200494ee3de721c56.tar.gz
TST: Add test for poisson exceptions.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/tests/test_random.py11
1 files changed, 10 insertions, 1 deletions
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))