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 PrintDraughtsSpaceRowTests(unittest.TestCase): def test_default_case(self): function = main.print_draughts_space_row with mock.patch('sys.stdout', new=io.StringIO()) as fake_stdout: function() output = fake_stdout.getvalue().strip() correct = '| | | | | | | | | | |' incorrect = "| | | | | | | | | |" value = incorrect != output error_message = "Only prints 9 spaces instead of 10." self.assertTrue(value, error_message) value = output == correct error_message = "Doesn't print the correct string." self.assertTrue(value, error_message) if __name__ == "__main__": tests = PrintDraughtsSpaceRowTests() tests.test_default_case()