<s> from __future__ import unicode_literals <EOL> from mock import call , MagicMock <EOL> import pytest <EOL> from cycli . binder import * <EOL> @ pytest . fixture <EOL> def binder ( ) : <EOL> return MagicMock ( ) <EOL> def test_curly_left ( binder ) : <EOL> curly_left ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:{>" ) , call ( "<STR_LIT:}>" , move_cursor = False ) ] ) <EOL> def test_curly_right_curly_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:}>" <EOL> curly_right ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> def test_curly_right_not_curly_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> curly_right ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:}>" ) ] ) <EOL> def test_paren_left ( binder ) : <EOL> paren_left ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:(>" ) , call ( "<STR_LIT:)>" , move_cursor = False ) ] ) <EOL> def test_paren_right_paren_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:)>" <EOL> paren_right ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> def test_paren_right_not_paren_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> paren_right ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:)>" ) ] ) <EOL> def test_bracket_left ( binder ) : <EOL> bracket_left ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:[>" ) , call ( "<STR_LIT:]>" , move_cursor = False ) ] ) <EOL> def test_bracket_right_bracket_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:]>" <EOL> bracket_right ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> def test_bracket_right_not_bracket_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> bracket_right ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:]>" ) ] ) <EOL> def test_apostrophe_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:'>" <EOL> apostrophe ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> def test_apostrophe_not_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> apostrophe ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT:'>" ) , call ( "<STR_LIT:'>" , move_cursor = False ) ] ) <EOL> def test_quote_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT>" <EOL> quote ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> def test_quote_not_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> quote ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT>" ) , call ( "<STR_LIT>" , move_cursor = False ) ] ) <EOL> def test_backtick_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT>" <EOL> backtick ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> def test_backtick_not_current ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> backtick ( binder ) <EOL> binder . cli . current_buffer . insert_text . assert_has_calls ( [ call ( "<STR_LIT>" ) , call ( "<STR_LIT>" , move_cursor = False ) ] ) <EOL> def test_backspace_no_pattern ( binder ) : <EOL> binder . cli . current_buffer . document . current_char = "<STR_LIT:n>" <EOL> backspace ( binder ) <EOL> binder . cli . current_buffer . delete_before_cursor . assert_called_once_with ( ) <EOL> @ pytest . mark . parametrize ( ( "<STR_LIT>" , "<STR_LIT>" ) , [ <EOL> ( "<STR_LIT:(>" , "<STR_LIT:)>" ) , <EOL> ( "<STR_LIT:[>" , "<STR_LIT:]>" ) , <EOL> ( "<STR_LIT:{>" , "<STR_LIT:}>" ) , <EOL> ( "<STR_LIT:'>" , "<STR_LIT:'>" ) , <EOL> ( '<STR_LIT:">' , '<STR_LIT:">' ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ] ) <EOL> def test_backspace_with_pattern ( char_before_cursor , current_char ) : <EOL> binder = MagicMock ( ) <EOL> binder . cli . current_buffer . document . char_before_cursor = char_before_cursor <EOL> binder . cli . current_buffer . document . current_char = current_char <EOL> backspace ( binder ) <EOL> binder . cli . current_buffer . cursor_right . assert_called_once_with ( ) <EOL> binder . cli . current_buffer . delete_before_cursor . assert_called_once_with ( <NUM_LIT:2> ) </s>
