def test_format_stdout_stderr05(self): """ If stdout and stderr are empty, an empty template is returned. """ expected = '[stdout]\n\n\n[stderr]\n' actual = format_stdout_stderr('', '', 1000) self.assertEqual(expected, actual)
def test_format_stdout_stderr00(self): """ If stdout and stderr are both smaller than the max length, the full representation should be displayed. """ stdout = "The quick brown fox jumps over the lazy dog." stderr = "The five boxing wizards jump quickly." expected = "[stdout]\n{0}\n\n[stderr]\n{1}".format(stdout, stderr) actual = format_stdout_stderr(stdout, stderr, 1000) self.assertEqual(expected, actual)
def test_format_stdout_stderr04(self): """ If the max length is not sufficient to even hold the stdout and stderr markers an empty string is returned. """ stdout = "The quick brown fox jumps over the lazy dog." stderr = "The five boxing wizards jump quickly." expected = '' actual = format_stdout_stderr(stdout, stderr, 4) self.assertEqual(expected, actual) self.assertEqual(0, len(actual))
def test_format_stdout_stderr03(self): """ If stdout is much larger than stderr, stdout is allowed to borrow space from stderr's quota. """ stdout = "The quick brown fox jumps over the lazy dog." stderr = "empty" expected = '[stdout]\nr the lazy dog.\n\n[stderr]\nempty' actual = format_stdout_stderr(stdout, stderr, 40) self.assertEqual(expected, actual) self.assertEqual(40, len(actual))
def test_format_stdout_stderr02(self): """ If stderr is much larger than stdout, stderr is allowed to borrow space from stdout's quota. """ stdout = "empty" stderr = "The five boxing wizards jump quickly." expected = '[stdout]\nempty\n\n[stderr]\ns jump quickly.' actual = format_stdout_stderr(stdout, stderr, 40) self.assertEqual(expected, actual) self.assertEqual(40, len(actual))
def test_format_stdout_stderr01(self): """ If stdout and stderr both exceed the max length, then both stdout and stderr are trimmed equally. """ stdout = "The quick brown fox jumps over the lazy dog." stderr = "The five boxing wizards jump quickly." # noinspection SpellCheckingInspection expected = '[stdout]\ns over the lazy dog.\n\n[stderr]\nizards jump quickly.' actual = format_stdout_stderr(stdout, stderr, 60) self.assertEqual(expected, actual) self.assertEqual(60, len(actual))