summaryrefslogtreecommitdiff
path: root/numpy/random/tests/test_random.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random/tests/test_random.py')
-rw-r--r--numpy/random/tests/test_random.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py
index 25277b6ba..449d6b410 100644
--- a/numpy/random/tests/test_random.py
+++ b/numpy/random/tests/test_random.py
@@ -116,39 +116,39 @@ class TestRandomDist(TestCase):
[ 0.4575674820298663 , 0.7781880808593471 ]])
np.testing.assert_array_almost_equal(actual, desired, decimal=15)
- def test_sample_uniform_replace(self):
+ def test_choice_uniform_replace(self):
np.random.seed(self.seed)
- actual = np.random.sample(4, 4)
+ actual = np.random.choice(4, 4)
desired = np.array([2, 3, 2, 3])
np.testing.assert_array_equal(actual, desired)
- def test_sample_nonuniform_replace(self):
+ def test_choice_nonuniform_replace(self):
np.random.seed(self.seed)
- actual = np.random.sample(4, 4, p=[0.4, 0.4, 0.1, 0.1])
+ actual = np.random.choice(4, 4, p=[0.4, 0.4, 0.1, 0.1])
desired = np.array([1, 0, 3, 0])
np.testing.assert_array_equal(actual, desired)
- def test_sample_uniform_noreplace(self):
+ def test_choice_uniform_noreplace(self):
np.random.seed(self.seed)
- actual = np.random.sample(4, 3, replace=False)
+ actual = np.random.choice(4, 3, replace=False)
desired = np.array([0, 1, 3])
np.testing.assert_array_equal(actual, desired)
- def test_sample_nonuniform_noreplace(self):
+ def test_choice_nonuniform_noreplace(self):
np.random.seed(self.seed)
- actual = np.random.sample(4, 3, replace=False,
+ actual = np.random.choice(4, 3, replace=False,
p=[0.1, 0.3, 0.5, 0.1])
desired = np.array([2, 1, 3])
np.testing.assert_array_equal(actual, desired)
- def test_sample_noninteger(self):
+ def test_choice_noninteger(self):
np.random.seed(self.seed)
- actual = np.random.sample(['a', 'b', 'c', 'd'], 4)
+ actual = np.random.choice(['a', 'b', 'c', 'd'], 4)
desired = np.array(['c', 'd', 'c', 'd'])
np.testing.assert_array_equal(actual, desired)
- def test_sample_exceptions(self):
- sample = np.random.sample
+ def test_choice_exceptions(self):
+ sample = np.random.choice
assert_raises(ValueError, sample, -1,3)
assert_raises(ValueError, sample, [[1,2],[3,4]], 3)
assert_raises(ValueError, sample, [], 3)