Example #1
0
 def test_moderate_composites(self):
     # Test is_probable_prime with moderate-sized composites.
     for i in range(10):
         # We should not run out of primes here. If we do, it's a bug
         # in the test.
         p, q = next(self.primes), next(self.primes)
         n = p * q
         assert n < 2**60, "n not in deterministic range for i_p_p"
         self.assertEqual(probabilistic.is_probable_prime(n), 0)
Example #2
0
 def test_moderate_composites(self):
     # Test is_probable_prime with moderate-sized composites.
     for i in range(10):
         # We should not run out of primes here. If we do, it's a bug
         # in the test.
         p, q = next(self.primes), next(self.primes)
         n = p*q
         assert n < 2**60, "n not in deterministic range for i_p_p"
         self.assertEqual(probabilistic.is_probable_prime(n), 0)
Example #3
0
 def test_moderate_primes(self):
     # Test is_probable_prime with a few moderate-sized primes.
     for p in itertools.islice(self.primes, 15):
         self.assertEqual(probabilistic.is_probable_prime(p), 1)
Example #4
0
 def test_moderate_primes(self):
     # Test is_probable_prime with a few moderate-sized primes.
     for p in itertools.islice(self.primes, 15):
         self.assertEqual(probabilistic.is_probable_prime(p), 1)