def test_cursor_back(): screen = Screen(10, 10) # Moving the cursor left at the margin doesn't do anything screen.cursor.x = 0 screen.cursor_back(1) assert screen.cursor.x == 0 screen.cursor.x = 3 # Moving the cursor past the left margin moves it to the left margin screen.cursor_back(10) assert screen.cursor.x == 0 screen.cursor.x = 5 # Can move the cursor more than one back. screen.cursor_back(3) assert screen.cursor.x == 2