def test_utf8(self): expected = '\u2122 \u2122 \u2122\n\u2122 \u2122 \u2122\n\u2122' text = '\u2122 \u2122 \u2122 \u2122 \u2122 \u2122 \u2122' liner.set_clipboard_data(text) liner.main(['-c', '-l', '5']) actual = liner.get_clipboard_data() self.assertEqual(expected, actual)
def test_trailing_whitespace(self): """ trailing whitespace is stripped """ expected = '\n\nabc\n\n' text = ' \n\t\t\nabc \n \n' liner.set_clipboard_data(text) liner.main(['-c']) actual = liner.get_clipboard_data() self.assertEqual(expected, actual)
def test_line_length_less_than_one_and_multiple_lines(self): """ lines are joined """ expected = ('Vivamus sagittis lacus vel augue laoreet rutrum ' 'faucibus dolor auctor. Nullam quis risus eget urna ' 'mollis ornare vel eu leo.') text = ('Vivamus sagittis lacus vel augue \nlaoreet rutrum ' 'faucibus dolor\nauctor. Nullam quis risus eget \n' 'urna mollis ornare\nvel eu leo.') liner.set_clipboard_data(text) liner.main(['-c', '-l', 0]) actual = liner.get_clipboard_data() self.assertEqual(expected, actual)
def test_line_length_as_string(self): liner.set_clipboard_data('Lorem ipsum dolor sit amet') liner.main(['-c', '-l', '017']) expected = 'Lorem ipsum dolor\nsit amet' actual = liner.get_clipboard_data() self.assertEqual(expected, actual)
def test_line_length_less_than_one_and_newline(self): expected = 'Lorem ipsum dolor sit amet\n' liner.set_clipboard_data(expected) liner.main(['-c', '-l', '-1']) actual = liner.get_clipboard_data() self.assertEqual(expected, actual)
def test_clipboard(self): expected = "Blah blah blah blah" liner.set_clipboard_data(expected) actual = liner.get_clipboard_data() self.assertEqual(expected, actual)
def setUp(self): self.save_clipboard = liner.get_clipboard_data()