mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 08:58:02 +00:00
Add check prime challenge (#226)
This commit is contained in:
22
math_probability/check_prime/test_check_prime.py
Normal file
22
math_probability/check_prime/test_check_prime.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from nose.tools import assert_equal, assert_raises
|
||||
|
||||
|
||||
class TestMath(object):
|
||||
|
||||
def test_check_prime(self):
|
||||
math = Math()
|
||||
assert_raises(TypeError, math.check_prime, None)
|
||||
assert_raises(TypeError, math.check_prime, 98.6)
|
||||
assert_equal(math.check_prime(0), False)
|
||||
assert_equal(math.check_prime(1), False)
|
||||
assert_equal(math.check_prime(97), True)
|
||||
print('Success: test_check_prime')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestMath()
|
||||
test.test_check_prime()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user