mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-31 06:33:44 +00:00
Added type hints and doctest for maths/prime_check. (#2367)
* Added type hints and doctest for maths/prime_check. * Removed doctests.
This commit is contained in:
parent
f2f0425357
commit
ab5a046581
|
@ -4,7 +4,7 @@ import math
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
def prime_check(number):
|
def prime_check(number: int) -> bool:
|
||||||
"""
|
"""
|
||||||
Check to See if a Number is Prime.
|
Check to See if a Number is Prime.
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class Test(unittest.TestCase):
|
||||||
def test_not_primes(self):
|
def test_not_primes(self):
|
||||||
self.assertFalse(prime_check(-19), "Negative numbers are not prime.")
|
self.assertFalse(prime_check(-19), "Negative numbers are not prime.")
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
prime_check(0), "Zero doesn't have any divider, primes must have two"
|
prime_check(0), "Zero doesn't have any divider, primes must have two."
|
||||||
)
|
)
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
prime_check(1), "One just have 1 divider, primes must have two."
|
prime_check(1), "One just have 1 divider, primes must have two."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user