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

class TwoPlusTwoEquationTests(unittest.TestCase):
    
    def test_default_case(self):
        function = main.two_plus_two_equation
        
        with mock.patch('sys.stdout', new=io.StringIO()) as fake_stdout:
            function()

        output = fake_stdout.getvalue().strip()
        
        correct = "5" not in output
        message = "I don't think you changed the correct number yet."
        self.assertTrue(correct, message)
        
        correct = "4" in output
        message = "What does 2 + 2 equal?"
        self.assertTrue(correct, message)
        
        no_spaces = output.replace(" ", "")
        correct = len(no_spaces) <= 5
        message = "You added too much to the print statement."
        self.assertTrue(correct, message)
        
        no_spaces = output.replace(" ", "")
        correct = len(no_spaces) >= 5
        message = "You took away too much from the print statement."
        self.assertTrue(correct, message)
        
        correct = no_spaces == "2+2=4"
        message = "You're not printing the correct equation."
        self.assertTrue(correct, message)
        
        
if __name__ == "__main__":
    tests = TwoPlusTwoEquationTests()
    tests.test_default_case()