import unittest import io import re from unittest import mock import math import student_X as main #Replace student_X with your filename class IsPrimeHelperTests(unittest.TestCase): def test_default_case(self): function = main.is_prime_helper test = False try: incorrect = "" result = function.__doc__.strip() test = incorrect != result except: pass self.assertTrue(test, "No docstring.") inputs = (529, 22) test = False correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result self.assertTrue(test, "Returned False when the first parameter isn't divisible by the second parameter or anything lower. (It should return True in this case.)") inputs = (2809, 53) test = False correct = False if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result self.assertTrue(test, "Doesn't return True when the first parameter is divisible by the second.") inputs = (961, 32) test = False correct = False if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result self.assertTrue(test, "Doesn't return True when the first parameter is divisible by something less than the second.") inputs = (53, 52) test = False correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result self.assertTrue(test, "Doesn't return True when first parameter is prime.") if __name__ == "__main__": tests = IsPrimeHelperTests() tests.test_default_case()