'Check a getrandbits()-like function.'

def _check_getrandbits(self, func, ptr):

    r = self._follow_cpython(ptr)
    for nbits in range(1, 65):
        expected = r.getrandbits(nbits)
        got = func(nbits)
        self.assertPreciseEqual(expected, got)
    self.assertRaises(OverflowError, func, 65)
    self.assertRaises(OverflowError, func, 9999999)
    self.assertRaises(OverflowError, func, (-1))
