def is3xprime(x): """ Tests if n is 3 times a prime """ if isprime(x): return False p = int(x / 3) if (p * 3) != x: return False return isprime(p)
def test_isnprime(self, n): is_it_prime = isprime(n) karma_prime = prime.isprime(n) if is_it_prime != None: # if isprime knows, check it agrees with our version assert (is_it_prime == karma_prime)
def is_magic(self): return isprime(self.x)
def test_is2prime(self): self.assertEqual(prime.isprime(2), True)
def _test_isprime(self): self.assertEqual(prime.isprime(2), isprime(2))