def test_is_prime_with_negative_input_raises_overflow_error(self): for x in (-1, -5, -33): with self.assertRaises(OverflowError): is_prime(x)
def test_is_prime_with_large_input(self): for x in (49968367, 49968371, 49968377): self.assertTrue(is_prime(x)) self.assertTrue(is_prime(2**31-1))
def test_is_not_prime_with_large_input(self): for x in (49968365, 49968373, 49968379): self.assertFalse(is_prime(x)) self.assertFalse(is_prime(2**31-3))
def test_first_ten_non_primes_are_non_prime(self): for x in (0, 1, 4, 6, 8, 9, 10, 12, 14, 15): self.assertFalse(is_prime(x))
def test_first_ten_primes_are_prime(self): for x in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29): self.assertTrue(is_prime(x))
def test_is_not_prime_with_large_input(self): for x in (49968365, 49968373, 49968379): self.assertFalse(is_prime(x)) self.assertFalse(is_prime(2**31 - 3))
def test_is_prime_with_large_input(self): for x in (49968367, 49968371, 49968377): self.assertTrue(is_prime(x)) self.assertTrue(is_prime(2**31 - 1))