当前位置: 首页>>代码示例>>Python>>正文


Python ViRunCommand.do_whole_motion方法代码示例

本文整理汇总了Python中Vintageous.run.ViRunCommand.do_whole_motion方法的典型用法代码示例。如果您正苦于以下问题:Python ViRunCommand.do_whole_motion方法的具体用法?Python ViRunCommand.do_whole_motion怎么用?Python ViRunCommand.do_whole_motion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vintageous.run.ViRunCommand的用法示例。


在下文中一共展示了ViRunCommand.do_whole_motion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Test_do_whole_motion

# 需要导入模块: from Vintageous.run import ViRunCommand [as 别名]
# 或者: from Vintageous.run.ViRunCommand import do_whole_motion [as 别名]
class Test_do_whole_motion(unittest.TestCase):
    def setUp(self):
        self.vi_run = ViRunCommand(mock.Mock())

    def testAbortsIfMustRepeatAction(self):
        vi_cmd_data = { '_repeat_action': True}
        with mock.patch.object(self.vi_run, 'do_pre_motion') as dprem:
            self.vi_run.do_whole_motion(vi_cmd_data)
            self.assertEqual(dprem.call_count, 0)

    def testCallsAllSteps(self):
        vi_cmd_data = { '_repeat_action': False,
                        'count': 1,
                        'last_motion': False,
                      }

        with mock.patch.object(self.vi_run, 'reorient_caret') as rec, \
             mock.patch.object(self.vi_run, 'do_pre_motion') as dprm, \
             mock.patch.object(self.vi_run, 'do_pre_every_motion') as dprem, \
             mock.patch.object(self.vi_run, 'do_motion') as dm, \
             mock.patch.object(self.vi_run, 'do_post_every_motion') as dpostem, \
             mock.patch.object(self.vi_run, 'do_last_motion') as dlm, \
             mock.patch.object(self.vi_run, 'do_post_motion') as dpostm, \
             mock.patch.object(self.vi_run, 'reposition_caret') as repc, \
             mock.patch.object(self.vi_run, 'add_to_jump_list') as addtjl:

            self.vi_run.do_whole_motion(vi_cmd_data)

            self.assertEqual(rec.call_count, 1)
            self.assertEqual(dprm.call_count, 1)
            self.assertEqual(dprem.call_count, 1)
            self.assertEqual(dm.call_count, 1)
            self.assertEqual(dpostem.call_count, 1)
            self.assertEqual(dlm.call_count, 0)
            self.assertEqual(dpostm.call_count, 1)
            self.assertEqual(repc.call_count, 1)
            self.assertEqual(addtjl.call_count, 1)

    def testCallsAllStepsNeededIfLastMotionPresent(self):
        vi_cmd_data = { '_repeat_action': False,
                        'count': 1,
                        'last_motion': '_whatever',
                      }

        with mock.patch.object(self.vi_run, 'reorient_caret') as rec, \
             mock.patch.object(self.vi_run, 'do_pre_motion') as dprm, \
             mock.patch.object(self.vi_run, 'do_pre_every_motion') as dprem, \
             mock.patch.object(self.vi_run, 'do_motion') as dm, \
             mock.patch.object(self.vi_run, 'do_post_every_motion') as dpostem, \
             mock.patch.object(self.vi_run, 'do_last_motion') as dlm, \
             mock.patch.object(self.vi_run, 'do_post_motion') as dpostm, \
             mock.patch.object(self.vi_run, 'reposition_caret') as repc, \
             mock.patch.object(self.vi_run, 'add_to_jump_list') as addtjl:

            self.vi_run.do_whole_motion(vi_cmd_data)

            self.assertEqual(rec.call_count, 1)
            self.assertEqual(dprm.call_count, 1)
            self.assertEqual(dprem.call_count, 1)
            self.assertEqual(dm.call_count, 0)
            self.assertEqual(dpostem.call_count, 0)
            self.assertEqual(dlm.call_count, 1)
            self.assertEqual(dpostm.call_count, 1)
            self.assertEqual(repc.call_count, 1)
            self.assertEqual(addtjl.call_count, 1)
开发者ID:KevinSjoberg,项目名称:Vintageous,代码行数:67,代码来源:test_run.py


注:本文中的Vintageous.run.ViRunCommand.do_whole_motion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。