import unittest import io import re from unittest import mock import math import student_X as main #Replace student_X with your filename class HasVowelsTests(unittest.TestCase): def test_default_case(self): function = main.has_vowels test = False try: incorrect = "" result = function.__doc__ result = result.strip() test = incorrect != result except: pass message = "No docstring." self.assertTrue(test, message) inputs = ('') correct = False if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on the empty string." self.assertTrue(test, message) inputs = ('x') correct = False if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a string with a single consonant character." self.assertTrue(test, message) inputs = ('e') correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a string with a single vowel character." self.assertTrue(test, message) inputs = ('xbc') correct = False if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a short string with no vowels." self.assertTrue(test, message) inputs = ('abc') correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a short string with a vowel." self.assertTrue(test, message) inputs = ('cab') correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a short string with a vowel." self.assertTrue(test, message) inputs = ('cba') correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a short string with a vowel." self.assertTrue(test, message) inputs = ('x' * 890) correct = False if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a long string with no vowels." self.assertTrue(test, message) inputs = ('x' * 809 + 'u') correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a long string with one vowel." self.assertTrue(test, message) inputs = ('x' * 809 + 'o' + 'y' * 809) correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a long string with one vowel." self.assertTrue(test, message) inputs = ('x' * 809 + 'i' + 'y' * 809) correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a long string with one vowel." self.assertTrue(test, message) inputs = ('x' * 809 + 'e' + 'y' * 809) correct = True if isinstance(inputs, tuple): result = function(*inputs) else: result = function(inputs) test = result == correct message = "Doesn't work on a long string with one vowel." self.assertTrue(test, message) if __name__ == "__main__": tests = HasVowelsTests() tests.test_default_case()