import unittest import io import re from unittest import mock import math import student_X as main #Replace student_X with your filename class CountTests(unittest.TestCase): def test_default_case(self): function = main.count inputs = ('venusaur', 'x') correct = 0 if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work when the string doesn't have the character." self.assertTrue(test, message) inputs = ('venusaur', 's') correct = 1 if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work when the character is in the string exactly once." self.assertTrue(test, message) inputs = ('venusaur', 'u') correct = 2 if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work when the character is in the string twice." self.assertTrue(test, message) inputs = ('venusauruu', 'u') correct = 4 if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work when the character is in the string many times." self.assertTrue(test, message) if __name__ == "__main__": tests = CountTests() tests.test_default_case()