本文整理汇总了Python中Vintageous.run.ViRunCommand.do_action方法的典型用法代码示例。如果您正苦于以下问题:Python ViRunCommand.do_action方法的具体用法?Python ViRunCommand.do_action怎么用?Python ViRunCommand.do_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vintageous.run.ViRunCommand
的用法示例。
在下文中一共展示了ViRunCommand.do_action方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test_do_action
# 需要导入模块: from Vintageous.run import ViRunCommand [as 别名]
# 或者: from Vintageous.run.ViRunCommand import do_action [as 别名]
class Test_do_action(unittest.TestCase):
def setUp(self):
self.vi_run = ViRunCommand(mock.Mock())
def testDoesNothingIfNoActionAvailable(self):
vi_cmd_data = {'action': None}
with mock.patch.object(self.vi_run, 'debug') as deb:
self.vi_run.do_action(vi_cmd_data)
deb.assert_called_once_with('Vintageous: Action command: ', None)
@mock.patch('Vintageous.run.VintageState.registers')
def testCallsYank(self, mocked_regs):
mocked_regs.yank = mock.Mock()
vi_cmd_data = {
'action': {'command': 'foo', 'args': {}},
'_repeat_action': False,
'is_window_command': False,
'mode': _MODE_INTERNAL_NORMAL,
'has_training_wheels': False,
}
self.vi_run.do_action(vi_cmd_data)
mocked_regs.yank.assert_called_once_with(vi_cmd_data)
@mock.patch('Vintageous.run.VintageState.registers')
def testRunsCommandOnceIfMustNotRepeatAction(self, mocked_regs):
mocked_regs.yank = mock.Mock()
vi_cmd_data = {
'action': {'command': 'foo', 'args': {}},
'_repeat_action': False,
'is_window_command': False,
'mode': _MODE_INTERNAL_NORMAL,
'has_training_wheels': False,
}
self.vi_run.do_action(vi_cmd_data)
self.vi_run.view.run_command.assert_called_once_with('foo', {})
@mock.patch('Vintageous.run.VintageState.registers')
def testRunsCommandExpectedTimes(self, mocked_regs):
mocked_regs.yank = mock.Mock()
vi_cmd_data = {
'action': {'command': 'foo', 'args': {}},
'_repeat_action': True,
'count': 10,
'is_window_command': False,
'mode': _MODE_INTERNAL_NORMAL,
'has_training_wheels': False,
}
self.vi_run.do_action(vi_cmd_data)
self.assertEqual(self.vi_run.view.run_command.call_count, 10)