本文整理汇总了Python中Vintageous.run.ViRunCommand.run方法的典型用法代码示例。如果您正苦于以下问题:Python ViRunCommand.run方法的具体用法?Python ViRunCommand.run怎么用?Python ViRunCommand.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vintageous.run.ViRunCommand
的用法示例。
在下文中一共展示了ViRunCommand.run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test_run
# 需要导入模块: from Vintageous.run import ViRunCommand [as 别名]
# 或者: from Vintageous.run.ViRunCommand import run [as 别名]
class Test_run(unittest.TestCase):
def setUp(self):
self.vi_run = ViRunCommand(mock.Mock())
@mock.patch('Vintageous.run.VintageState')
def testFinallySection(self, mocked_state):
vi_cmd_data = { '_repeat_action': True,
'creates_jump_at_current_position': False,
'is_jump': False,
'action': None,
'mode': None,
'must_update_xpos': False,
'scroll_into_view': False,
'next_mode': 10,
'follow_up_mode': 100,
}
self.vi_run.view.sel.return_value = []
thing = mock.Mock()
thing.next_mode = 0
mocked_state.return_value = thing
with mock.patch.object(self.vi_run, 'save_caret_pos') as savec, \
mock.patch.object(self.vi_run, 'do_whole_motion') as dowhm, \
mock.patch.object(self.vi_run, 'debug') as debug, \
mock.patch.object(self.vi_run, 'do_post_action') as doposac, \
mock.patch.object(self.vi_run, 'do_modify_selections') as domodsel, \
mock.patch.object(self.vi_run, 'restore_original_carets_if_needed') as restorc:
self.vi_run.run(None, **vi_cmd_data)
self.assertEqual(savec.call_count, 1)
self.assertEqual(dowhm.call_count, 1)
self.assertEqual(debug.call_count, 1)
self.assertEqual(doposac.call_count, 1)
self.assertEqual(domodsel.call_count, 1)
self.assertEqual(restorc.call_count, 1)
self.assertEqual(thing.next_mode, 10)
self.assertEqual(thing.next_mode_command, 100)
@mock.patch('Vintageous.run.VintageState')
def testFinallySectionWhenXposMustBeUpdated(self, mocked_state):
vi_cmd_data = { '_repeat_action': True,
'creates_jump_at_current_position': False,
'is_jump': False,
'action': None,
'mode': None,
'must_update_xpos': True,
'scroll_into_view': False,
'next_mode': 10,
'follow_up_mode': 100,
}
self.vi_run.view.sel.return_value = []
thing = mock.Mock()
thing.next_mode = 0
mocked_state.return_value = thing
with mock.patch.object(self.vi_run, 'save_caret_pos') as savec, \
mock.patch.object(self.vi_run, 'do_whole_motion') as dowhm, \
mock.patch.object(self.vi_run, 'debug') as debug, \
mock.patch.object(self.vi_run, 'do_post_action') as doposac, \
mock.patch.object(self.vi_run, 'do_modify_selections') as domodsel, \
mock.patch.object(self.vi_run, 'restore_original_carets_if_needed') as restorc:
self.vi_run.run(None, **vi_cmd_data)
self.assertEqual(savec.call_count, 1)
self.assertEqual(dowhm.call_count, 1)
self.assertEqual(debug.call_count, 1)
self.assertEqual(doposac.call_count, 1)
self.assertEqual(domodsel.call_count, 1)
self.assertEqual(restorc.call_count, 1)
self.assertEqual(thing.next_mode, 10)
self.assertEqual(thing.next_mode_command, 100)
self.assertEqual(thing.update_xpos.call_count, 1)
@mock.patch('Vintageous.run.VintageState')
def testFinallySectionWhenMustScrollIntoView(self, mocked_state):
vi_cmd_data = { '_repeat_action': True,
'creates_jump_at_current_position': False,
'is_jump': False,
'action': None,
'mode': None,
'must_update_xpos': False,
'scroll_into_view': True,
'scroll_command': None,
'next_mode': 10,
'follow_up_mode': 100,
}
self.vi_run.view.sel.return_value = []
thing = mock.Mock()
thing.next_mode = 0
mocked_state.return_value = thing
self.vi_run.view.sel.return_value = [500]
#.........这里部分代码省略.........