def test_bug_duplicate_line_undo_stack(editor):
    editor.setPlainText('foo\nbar', '', 'utf-8')
    editor.textCursor().setPosition(0)
    editor.indent()
    editor.duplicate_line()
    editor.undo()
    assert editor.toPlainText() == '    foo\nbar'
    assert editor.textCursor().position() == 7
See github issue #142 where the duplicate line messup the undo stack
dataset/ETHPy150Open pyQode/pyqode.core/test/test_api/test_code_edit.py/test_bug_duplicate_line_undo_stack