import unittest
import io
import re
from unittest import mock
import math
import student_X as main #Replace student_X with your filename 
    
    
    
 

class ToFancyTitleTests(unittest.TestCase):

    def test_default_case(self):
        function = main.to_fancy_title
        
        test = False
        try:
            incorrect = ""
            result = function.__doc__
            result = result.strip()
            test = incorrect != result
        except:
            pass
        message = "No docstring."
        self.assertTrue(test, message)

        
        inputs = ("banana")
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = not 'banana' in result
        message = "Doesn't capitalize the string in the title."
        self.assertTrue(test, message)

        
        inputs = ("banana")
        incorrect = "~" * 32 + "Banana" + "~" * 32
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result != incorrect
        message = "Doesn't put the spaces before or after the titled string."
        self.assertTrue(test, message)

        
        inputs = ("banana")
        correct = "~" * 31 + " Banana " + "~" * 31
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on 'banana'."
        self.assertTrue(test, message)

        
        inputs = ("hi there")
        correct = "~" * 30 + " Hi There " + "~" * 30
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on a string with a space."
        self.assertTrue(test, message)

        
        inputs = ("banana Cheeses in the swimming pools")
        correct = "~" * 16 + " Banana Cheeses In The Swimming Pools " + "~" * 16
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on a string with lots of words."
        self.assertTrue(test, message)
        
if __name__ == "__main__":
    tests = ToFancyTitleTests()
    tests.test_default_case()