diff --git a/maths/prime_check.py b/maths/prime_check.py
index c17877a57705..f1bc4def2469 100644
--- a/maths/prime_check.py
+++ b/maths/prime_check.py
@@ -29,12 +29,19 @@ def is_prime(number: int) -> bool:
     True
     >>> is_prime(67483)
     False
+    >>> is_prime(16.1)
+    Traceback (most recent call last):
+        ...
+    ValueError: is_prime() only accepts positive integers
+    >>> is_prime(-4)
+    Traceback (most recent call last):
+        ...
+    ValueError: is_prime() only accepts positive integers
     """
 
     # precondition
-    assert isinstance(number, int) and (
-        number >= 0
-    ), "'number' must been an int and positive"
+    if not isinstance(number, int) or not number >= 0:
+        raise ValueError("is_prime() only accepts positive integers")
 
     if 1 < number < 4:
         # 2 and 3 are primes
@@ -64,7 +71,7 @@ def test_primes(self):
         assert is_prime(29)
 
     def test_not_primes(self):
-        with pytest.raises(AssertionError):
+        with pytest.raises(ValueError):
             is_prime(-19)
         assert not is_prime(
             0