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


Python MagicMock.tab_title方法代码示例

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


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

示例1: insert_tab_not_visible_test

# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import tab_title [as 别名]
    def insert_tab_not_visible_test(self):
        """
        Test that the insert_tab() method works correctly when a tab that should not be visible is inserted
        """
        # GIVEN: A general tab and a Settings Form
        settings_form = SettingsForm(None)
        general_tab = MagicMock()
        general_tab.tab_title = 'mock'

        # WHEN: We insert the general tab
        with patch.object(settings_form.stacked_layout, 'addWidget') as mocked_add_widget, \
                patch.object(settings_form.setting_list_widget, 'addItem') as mocked_add_item:
            settings_form.insert_tab(general_tab, is_visible=False)

            # THEN: The general tab should have been inserted, but no list item should have been inserted into the list
            mocked_add_widget.assert_called_with(general_tab)
            self.assertEqual(0, mocked_add_item.call_count, 'addItem should not have been called')
开发者ID:crossroadchurch,项目名称:paul,代码行数:19,代码来源:test_settingsform.py

示例2: insert_tab_visible_test

# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import tab_title [as 别名]
    def insert_tab_visible_test(self):
        """
        Test that the insert_tab() method works correctly when a visible tab is inserted
        """
        # GIVEN: A mocked tab and a Settings Form
        settings_form = SettingsForm(None)
        general_tab = MagicMock()
        general_tab.tab_title = 'mock'
        general_tab.tab_title_visible = 'Mock'
        general_tab.icon_path = ':/icon/openlp-logo-16x16.png'

        # WHEN: We insert the general tab
        with patch.object(settings_form.stacked_layout, 'addWidget') as mocked_add_widget, \
                patch.object(settings_form.setting_list_widget, 'addItem') as mocked_add_item:
            settings_form.insert_tab(general_tab, is_visible=True)

            # THEN: The general tab should have been inserted into the stacked layout and an item inserted into the list
            mocked_add_widget.assert_called_with(general_tab)
            self.assertEqual(1, mocked_add_item.call_count, 'addItem should have been called')
开发者ID:crossroadchurch,项目名称:paul,代码行数:21,代码来源:test_settingsform.py


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