MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / test_not_primes

Method test_not_primes

maths/prime_check.py:73–86  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71 assert is_prime(29)
72
73 def test_not_primes(self):
74 with pytest.raises(ValueError):
75 is_prime(-19)
76 assert not is_prime(0), (
77 "Zero doesn't have any positive factors, primes must have exactly two."
78 )
79 assert not is_prime(1), (
80 "One only has 1 positive factor, primes must have exactly two."
81 )
82 assert not is_prime(2 * 2)
83 assert not is_prime(2 * 3)
84 assert not is_prime(3 * 3)
85 assert not is_prime(3 * 5)
86 assert not is_prime(3 * 5 * 7)
87
88
89if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

is_primeFunction · 0.70

Tested by

no test coverage detected