Esempio n. 1
0
 def test_size_is_not_none(self):
     with mock.patch('cupy.random.sample_.randint') as m:
         random.random_integers(3, 5, (1, 2, 3))
     m.assert_called_with(3, 6, (1, 2, 3))
Esempio n. 2
0
 def test_bound_1(self):
     vals = [random.random_integers(0, 10, (2, 3)).get() for _ in range(10)]
     for val in vals:
         self.assertEqual(val.shape, (2, 3))
     self.assertEqual(min(_.min() for _ in vals), 0)
     self.assertEqual(max(_.max() for _ in vals), 10)
Esempio n. 3
0
 def test_bound_2(self):
     vals = [random.random_integers(0, 2).get() for _ in range(20)]
     for val in vals:
         assert val.shape == ()
     assert min(vals) == 0
     assert max(vals) == 2
Esempio n. 4
0
 def test_high_is_none(self):
     with mock.patch('cupy.random.sample_.randint') as m:
         random.random_integers(3, None)
     m.assert_called_with(1, 4, None)
Esempio n. 5
0
 def test_upper_bound(self):
     val = random.random_integers(0, 2).get()
     self.assertEqual(2, val)
Esempio n. 6
0
 def test_bound_1(self):
     vals = [random.random_integers(0, 10, (2, 3)).get() for _ in range(10)]
     for val in vals:
         assert val.shape == (2, 3)
     assert min(_.min() for _ in vals) == 0
     assert max(_.max() for _ in vals) == 10
Esempio n. 7
0
 def test_size_is_not_none(self):
     random.random_integers(3, 5, (1, 2, 3))
     random.sample_.randint.assert_called_with(3, 6, (1, 2, 3))
Esempio n. 8
0
 def test_upper_bound(self):
     val = random.random_integers(0, 2).get()
     self.assertEqual(2, val)
Esempio n. 9
0
 def test_normal(self):
     random.random_integers(3, 5)
     random.sample_.randint.assert_called_with(3, 6, None)
Esempio n. 10
0
 def test_high_is_none(self):
     random.random_integers(3, None)
     random.sample_.randint.assert_called_with(1, 4, None)
Esempio n. 11
0
 def test_normal(self):
     random.random_integers(3, 5)
     random.sample_.randint.assert_called_with(3, 6, None)
Esempio n. 12
0
 def test_size_is_not_none(self):
     random.random_integers(3, 5, (1, 2, 3))
     random.sample_.randint.assert_called_with(3, 6, (1, 2, 3))
Esempio n. 13
0
 def test_high_is_none(self):
     random.random_integers(3, None)
     random.sample_.randint.assert_called_with(1, 4, None)
Esempio n. 14
0
 def test_bound_2(self):
     vals = [random.random_integers(0, 2).get() for _ in range(20)]
     for val in vals:
         self.assertEqual(val.shape, ())
     self.assertEqual(min(vals), 0)
     self.assertEqual(max(vals), 2)
Esempio n. 15
0
 def test_within_interval(self):
     val = random.random_integers(0, 10, (2, 3)).get()
     numpy.testing.assert_array_less(
         numpy.full((2, 3), -1, dtype=numpy.int64), val)
     numpy.testing.assert_array_less(
         val, numpy.full((2, 3), 11, dtype=numpy.int64))
Esempio n. 16
0
 def test_normal(self):
     with mock.patch('cupy.random.sample_.randint') as m:
         random.random_integers(3, 5)
     m.assert_called_with(3, 6, None)
Esempio n. 17
0
 def test_within_interval(self):
     val = random.random_integers(0, 10, (2, 3)).get()
     numpy.testing.assert_array_less(
         numpy.full((2, 3), -1, dtype=numpy.int64), val)
     numpy.testing.assert_array_less(
         val, numpy.full((2, 3), 11, dtype=numpy.int64))