本文整理汇总了Python中awscli.clidocs.OperationDocumentEventHandler.build_translation_map方法的典型用法代码示例。如果您正苦于以下问题:Python OperationDocumentEventHandler.build_translation_map方法的具体用法?Python OperationDocumentEventHandler.build_translation_map怎么用?Python OperationDocumentEventHandler.build_translation_map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类awscli.clidocs.OperationDocumentEventHandler
的用法示例。
在下文中一共展示了OperationDocumentEventHandler.build_translation_map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTranslationMap
# 需要导入模块: from awscli.clidocs import OperationDocumentEventHandler [as 别名]
# 或者: from awscli.clidocs.OperationDocumentEventHandler import build_translation_map [as 别名]
class TestTranslationMap(unittest.TestCase):
def setUp(self):
self.arg_table = {}
self.help_command = mock.Mock()
self.help_command.event_class = 'custom'
self.help_command.arg_table = self.arg_table
self.operation_model = mock.Mock()
self.operation_model.service_model.operation_names = []
self.help_command.obj = self.operation_model
self.operation_handler = OperationDocumentEventHandler(
self.help_command)
def assert_rendered_docs_contain(self, expected):
writes = [args[0][0] for args in
self.help_command.doc.write.call_args_list]
writes = '\n'.join(writes)
self.assertIn(expected, writes)
def test_boolean_arg_groups(self):
builder = DenormalizedStructureBuilder()
input_model = builder.with_members({
'Flag': {'type': 'boolean'}
}).build_model()
argument_model = input_model.members['Flag']
argument_model.name = 'Flag'
self.arg_table['flag'] = mock.Mock(
cli_type_name='boolean', argument_model=argument_model)
self.arg_table['no-flag'] = mock.Mock(
cli_type_name='boolean', argument_model=argument_model)
# The --no-flag should not be used in the translation.
self.assertEqual(
self.operation_handler.build_translation_map(),
{'Flag': 'flag'}
)