Ejemplo n.º 1
0
    def test_random_integers(self):
        rnd.seed(self.seed, self.brng)
        with suppress_warnings() as sup:
            w = sup.record(DeprecationWarning)
            actual = rnd.random_integers(-99, 99, size=(3, 2))
            assert_(len(w) == 1)

        desired = np.array([[96, -96], [-64, 42], [4, 97]])
        np.testing.assert_array_equal(actual, desired)
Ejemplo n.º 2
0
 def test_random_integers_max_int(self):
     # Tests whether random_integers can generate the
     # maximum allowed Python int that can be converted
     # into a C long. Previous implementations of this
     # method have thrown an OverflowError when attempting
     # to generate this integer.
     with suppress_warnings() as sup:
         w = sup.record(DeprecationWarning)
         actual = rnd.random_integers(np.iinfo('l').max, np.iinfo('l').max)
         assert_(len(w) == 1)
     desired = np.iinfo('l').max
     np.testing.assert_equal(actual, desired)