From d1d87e61295033649f6a363a909f4057a9db8258 Mon Sep 17 00:00:00 2001 From: Daisuke Oyama Date: Wed, 6 Jul 2016 21:21:41 +0900 Subject: [PATCH] probvec: Add tests --- quantecon/random/tests/test_utilities.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/quantecon/random/tests/test_utilities.py b/quantecon/random/tests/test_utilities.py index 46466aae0..dccd88e7a 100644 --- a/quantecon/random/tests/test_utilities.py +++ b/quantecon/random/tests/test_utilities.py @@ -3,13 +3,33 @@ Functions --------- +probvec sample_without_replacement """ import numpy as np from numpy.testing import assert_array_equal, assert_raises from nose.tools import eq_ -from quantecon.random import sample_without_replacement +from quantecon.random import probvec, sample_without_replacement + + +# probvec # + +class TestProbvec: + def setUp(self): + self.m, self.k = 2, 3 # m vectors of dimension k + seed = 1234 + + self.out_parallel = probvec(self.m, self.k, random_state=seed) + self.out_cpu = \ + probvec(self.m, self.k, random_state=seed, parallel=False) + + def test_shape(self): + for out in [self.out_parallel, self.out_cpu]: + eq_(out.shape, (self.m, self.k)) + + def test_parallel_cpu(self): + assert_array_equal(self.out_parallel, self.out_cpu) # sample_without_replacement #