Exemple #1
0
 def test_factorize(self):
     primes = integers.getprimes(50)
     num = 1
     expected = []
     for prime in primes:
         power = random.randint(0, 5)
         if power == 0: continue
         expected.append((prime, power))
         num *= (prime**power)
     actual = integers.factorize(num, primes)
     self.assertEqual(expected, actual)
 def test_factorize(self):
     primes = integers.getprimes(50)
     num = 1
     expected = []
     for prime in primes:
         power = random.randint(0, 5)
         if power == 0:
             continue
         expected.append((prime, power))
         num *= prime ** power
     actual = integers.factorize(num, primes)
     self.assertEqual(expected, actual)
Exemple #3
0
 def test_getprimes(self):
     expected = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
     actual = integers.getprimes(50)
     self.assertEqual(expected, actual)
 def test_getprimes(self):
     expected = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
     actual = integers.getprimes(50)
     self.assertEqual(expected, actual)