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


Python Interpreter.do_update方法代码示例

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


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

示例1: test_update_module_args_ignore_nonkv

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_module_args_ignore_nonkv(self, mock_stdout):
        module_args = 'key1=v1 key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)
        arg = 'nonkv_args'
        interpreter.do_update('module_args %s' % (arg))

        expected_kv = '%s' % (module_args)  # should not include arg
        self.assertEqual(expected_kv, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:11,代码来源:interpreter_test.py

示例2: test_update_module_args_skip_quote

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_module_args_skip_quote(self, mock_stdout):
        module_args = '"key1=v1" key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)
        kv = 'key1=v3'
        interpreter.do_update('module_args %s' % (kv))

        expected_kv = '%s %s' % (module_args, kv)
        self.assertEqual(expected_kv, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:11,代码来源:interpreter_test.py

示例3: test_update_module_args_replace_template

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_module_args_replace_template(self, mock_stdout):
        module_args = 'key1={{ var1 }} key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)
        kv = 'key1={{ var3 }}'
        interpreter.do_update('module_args %s' % (kv))

        expected_kv = '%s key2=v2' % kv
        self.assertEqual(expected_kv, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:11,代码来源:interpreter_test.py

示例4: test_update_complex_args_empty_kv

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_complex_args_empty_kv(self, mock_stdout):
        complex_args = {'key1': 'v1'}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        with patch('__builtin__.raw_input', side_effect=['']):
            interpreter.do_update('complex_args')

        expect = {'key1': 'v1'}  # change nothing
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:12,代码来源:interpreter_test.py

示例5: test_update_complex_args_empty_value

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_complex_args_empty_value(self, mock_stdout):
        complex_args = {'key1': 'v1'}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'key1'
        with patch('__builtin__.raw_input', side_effect=['']):
            interpreter.do_update('complex_args %s:' % (key))

        expect = {'key1': None}
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py

示例6: test_update_complex_args_wrong_key

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_complex_args_wrong_key(self, mock_stdout):
        complex_args = {'key1': {'key2': 'v2'}}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'key1[0]'
        value = 'v3'
        with patch('__builtin__.raw_input', side_effect=['']):
            interpreter.do_update('complex_args %s: %s' % (key, value))

        expect = {'key1': {'key2': 'v2'}}  # change nothing
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:14,代码来源:interpreter_test.py

示例7: test_update_complex_args_long_key

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_complex_args_long_key(self, mock_stdout):
        complex_args = {'k1': [{'k2': [{'k3': ['v']}]}]}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'k1[0].k2[0]'
        value = ['v2', '']
        with patch('__builtin__.raw_input', side_effect=value):
            interpreter.do_update('complex_args %s:' % (key))

        expect = {'k1': [{'k2': ['v2']}]}
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:14,代码来源:interpreter_test.py

示例8: test_update_complex_args_replace_dict

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_complex_args_replace_dict(self, mock_stdout):
        complex_args = {'key1': {'k2': 'v2'}}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'key1'
        value = ['k3: v3', '']
        with patch('__builtin__.raw_input', side_effect=value):
            interpreter.do_update('complex_args %s:' % (key))

        expect = {'key1': {'k3': 'v3'}}
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:14,代码来源:interpreter_test.py

示例9: test_update_complex_args_append_element

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_update [as 别名]
    def test_update_complex_args_append_element(self, mock_stdout):
        complex_args = {'key1': ['v1', 'v2']}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'key1[2]'
        value = 'v3'
        with patch('__builtin__.raw_input', side_effect=['']):
            interpreter.do_update('complex_args %s: %s' % (key, value))

        expect = {'key1': ['v1', 'v2', 'v3']}
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:14,代码来源:interpreter_test.py


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