コード例 #1
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)
コード例 #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)
コード例 #3
0
 def test_high_is_none(self):
     with mock.patch('dpnp.random.sample_.randint') as m:
         random.random_integers(3, None)
     m.assert_called_with(1, 4, None)
コード例 #4
0
 def test_size_is_not_none(self):
     with mock.patch('dpnp.random.sample_.randint') as m:
         random.random_integers(3, 5, (1, 2, 3))
     m.assert_called_with(3, 6, (1, 2, 3))
コード例 #5
0
 def test_normal(self):
     with mock.patch('dpnp.random.sample_.randint') as m:
         random.random_integers(3, 5)
     m.assert_called_with(3, 6, None)