import unittest import io import re from unittest import mock import math import student_X as main #Replace student_X with your filename class CharTwoStringsTests(unittest.TestCase): def test_default_case(self): function = main.char_two_strings test = False try: incorrect = "" result = function.__doc__.strip() test = incorrect != result except: pass message = "No docstring." self.assertTrue(test, message) inputs = ("", "boy", 2) test = False correct = 'y' if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result message = "Doesn't work when the first string is empty." self.assertTrue(test, message) inputs = ("cheese", "", 2) test = False correct = 'e' if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result message = "Doesn't work when the second string is empty." self.assertTrue(test, message) inputs = ("a", "I", 0) test = False correct = 'a' if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result message = "Doesn't work when the strings only have one character." self.assertTrue(test, message) inputs = ("a", "I", 1) test = False correct = 'I' if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result message = "Doesn't work when the strings only have one character." self.assertTrue(test, message) inputs = ("banana", "boy", 5) test = False correct = 'a' if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result message = "Doesn't work when the index is in the first string." self.assertTrue(test, message) inputs = ("banana", "boy", 7) test = False correct = 'o' if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = correct == result message = "Doesn't work when the index is in the second string." self.assertTrue(test, message) if __name__ == "__main__": tests = CharTwoStringsTests() tests.test_default_case()