import unittest import io from unittest import mock #import main import math import copy import inspect import student_X as main #Replace student_X with your filename class TwentySidedDieRollTests(unittest.TestCase): def test_default_case(self): # Your test case logic here (replace the example assertion below) # You may also rename this to any function in the form of 'test_your_test_name(self):' die = main.TwentySidedDie() incorrect = "" try: doc = die.roll.__doc__ doc = doc.strip() except: doc = "" test = doc != incorrect message = "No docstring." self.assertTrue(test, message) rolls = [] for i in range(5000): rolls.append(die.roll()) for i in range(20): x = i + 1 test = x in rolls message = "Can't roll a " + str(x) + "." self.assertTrue(test, message) if __name__ == "__main__": tests = TwentySidedDieRollTests() tests.test_default_case()