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

class SmallestMissingDigitTests(unittest.TestCase):

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

        
        inputs = ('Yo, no digits here!')        
        correct = 0
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when there are no numerical digits in the string."
        self.assertTrue(test, message)

        
        inputs = ('')
        correct = 0
        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 = ('A')
        correct = 0
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on 'A'."
        self.assertTrue(test, message)

        
        inputs = ('0')
        correct = 1
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '0'."
        self.assertTrue(test, message)

        
        inputs = ('0123')
        correct = 4
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '0123'."
        self.assertTrue(test, message)

        
        inputs = ('01230231')
        correct = 4
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '01230231'."
        self.assertTrue(test, message)

        
        inputs = ('0123456789')
        correct = None
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '0123456789'."
        self.assertTrue(test, message)

        
        inputs = ('0124')
        correct = 3
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '0124'."
        self.assertTrue(test, message)

        
        inputs = ('123')
        correct = 0
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '123'."
        self.assertTrue(test, message)

        
        inputs = ('01346')
        correct = 2
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '64310'."
        self.assertTrue(test, message)

        
        inputs = ('0a')
        correct = 1
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on '0a'."
        self.assertTrue(test, message)

        
        inputs = ('a20')
        correct = 1
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work on the string a20."
        self.assertTrue(test, message)

        
        inputs = ('N0 1 is here but us 3...')
        correct = 2
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when there are some numbers and some text and a missing digit."
        self.assertTrue(test, message)

        
        inputs = ('1 2 3, y0u cannot see me.  4 5 6, I 8 those sticks.')
        correct = 7
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when there are lots numbers and text, but there's still a missing digit."
        self.assertTrue(test, message)

        
        inputs = ('0123987645.  There are all of them!')
        correct = None
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when all digits are in the string along with other text."
        self.assertTrue(test, message)

        
        inputs = ('Time to make the donuts 0t1x2y3z9e8e7e6e4e5.  There are all of them!')
        correct = None
        if isinstance(inputs, tuple):
            result = function(*inputs)
        else:
            result = function(inputs)
        test = result == correct
        message = "Doesn't work when all digits are in the string along with other text."
        self.assertTrue(test, message)
        
        
if __name__ == "__main__":
    tests = SmallestMissingDigitTests()
    tests.test_default_case()