本文整理汇总了Python中tests.functional.MagicMock.also_supports方法的典型用法代码示例。如果您正苦于以下问题:Python MagicMock.also_supports方法的具体用法?Python MagicMock.also_supports怎么用?Python MagicMock.also_supports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.functional.MagicMock
的用法示例。
在下文中一共展示了MagicMock.also_supports方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_file_mask_string_test
# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import also_supports [as 别名]
def build_file_mask_string_test(self):
"""
Test the build_file_mask_string() method
"""
# GIVEN: Different controllers.
impress_controller = MagicMock()
impress_controller.enabled.return_value = True
impress_controller.supports = ['odp']
impress_controller.also_supports = ['ppt']
presentation_controller = MagicMock()
presentation_controller.enabled.return_value = True
presentation_controller.supports = ['ppt']
presentation_controller.also_supports = []
presentation_viewer_controller = MagicMock()
presentation_viewer_controller.enabled.return_value = False
pdf_controller = MagicMock()
pdf_controller.enabled.return_value = True
pdf_controller.supports = ['pdf']
pdf_controller.also_supports = ['xps', 'oxps']
# Mock the controllers.
self.media_item.controllers = {
'Impress': impress_controller,
'Powerpoint': presentation_controller,
'Powerpoint Viewer': presentation_viewer_controller,
'Pdf': pdf_controller
}
# WHEN: Build the file mask.
with patch('openlp.plugins.presentations.lib.mediaitem.translate') as mocked_translate:
mocked_translate.side_effect = lambda module, string_to_translate: string_to_translate
self.media_item.build_file_mask_string()
# THEN: The file mask should be generated correctly
self.assertIn('*.odp', self.media_item.on_new_file_masks, 'The file mask should contain the odp extension')
self.assertIn('*.ppt', self.media_item.on_new_file_masks, 'The file mask should contain the ppt extension')
self.assertIn('*.pdf', self.media_item.on_new_file_masks, 'The file mask should contain the pdf extension')
self.assertIn('*.xps', self.media_item.on_new_file_masks, 'The file mask should contain the xps extension')
self.assertIn('*.oxps', self.media_item.on_new_file_masks, 'The file mask should contain the oxps extension')