예제 #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)
예제 #2
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)
예제 #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)
예제 #4
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)