示例#1
0
 def test_prime_generator(self):
     primes = make_primes(100)
     g = prime_generator()
     i, n = 0, 0
     while True:
         n = g.next()
         if n > 100:
             break
         self.assertEqual(n, primes[i])
         i += 1
示例#2
0
 def test_make_primes(self):
     primes = make_primes(100)
     for i in primes:
         self.assertTrue(is_prime(i))