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

class FindLastTests(unittest.TestCase):

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

        
        inputs = ('venusaur', 'x')
        correct = -1
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when the character isn't in the string."
        self.assertTrue(test, message)

        
        inputs = ('venusaur', 'r')
        correct = 7
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when the character is the last character in the string (and isn't anywhere else)."
        self.assertTrue(test, message)

        
        inputs = ('venusaur', 's')
        correct = 4
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when the character is only in the string in one place."
        self.assertTrue(test, message)

        
        inputs = ('venusaur', 'u')
        correct = 6
        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 in two places."
        self.assertTrue(test, message)

        
        inputs = ('rvenusaur', 'r')
        correct = 8
        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 in two places."
        self.assertTrue(test, message)

        
        inputs = ('rvrernrursaun', 'r')
        correct = 8
        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 in many places."
        self.assertTrue(test, message)
        
        
if __name__ == "__main__":
    tests = FindLastTests()
    tests.test_default_case()