def test_restart_line_wide(self): eq = self.assertEqual for file, mul, extra in (('', 22, ''), ('finame', 21, '=')): width = 60 bar = mul * '=' with self.subTest(file=file, bar=bar): file = file or 'Shell' line = pyshell.restart_line(width, file) eq(len(line), width) eq(line, f"{bar+extra} RESTART: {file} {bar}")
def test_restart_line_narrow(self): expect, taglen = "= RESTART: Shell", 16 for width in (taglen - 1, taglen, taglen + 1): with self.subTest(width=width): self.assertEqual(pyshell.restart_line(width, ''), expect) self.assertEqual(pyshell.restart_line(taglen + 2, ''), expect + ' =')