def test_add_user_input_fill(self): cmd = "top -a" totalout_lines = [prompt + "ls", fill_line('main.py', c='.'), prompt] addUserInput(cmd, totalout_lines) expected = [ prompt + "ls", fill_line('main.py', c='.'), fill_line(prompt + cmd, c='.', compensation=10) ] self.assertEqual(totalout_lines, expected)
def test_addOutput_over_IN_WIDTH(self): totalout_lines = [] result = [ fill_line('ideas.py', '.'), fill_line('main.py', '.'), fill_line('test.py', '.'), fill_line('utils.py', '.'), ] addOutput(self.ls_output, totalout_lines) self.assertEqual(totalout_lines, result)
def test_addOutput_ls(self): totalout_lines = [] result = [ fill_line('ideas.py', '.'), fill_line('main.py', '.'), fill_line('test.py', '.'), fill_line('utils.py', '.'), ] addOutput(self.ls_output, totalout_lines, in_width=80) self.assertEqual(totalout_lines, result)
def test_fill_line_invalid_char(self): l = 'asdf' c = '..' in_width = 80 expected = 'asdf' + ('.' * (in_width - len(l))) self.assertRaises(InvalidArgument, lambda: fill_line(l, c, in_width=in_width))
def test_fill_line(self): l = 'asdf' c = '.' in_width = 80 expected = 'asdf' + ('.' * (in_width - len(l))) result = fill_line(l, c, in_width=in_width) self.assertEqual(expected, result)
def test_addOutput_1_line(self): output = 'ideas.py\n' totalout_lines = [] result = [ fill_line('ideas.py', '.'), ] addOutput(output, totalout_lines) self.assertEqual(totalout_lines, result)