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


Python MagicMock.book方法代码示例

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


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

示例1: build_song_footer_base_songbook_test

# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import book [as 别名]
    def build_song_footer_base_songbook_test(self):
        """
        Test build songs footer with basic song and a songbook
        """
        # GIVEN: A Song and a Service Item
        mock_song = MagicMock()
        mock_song.title = 'My Song'
        mock_song.copyright = 'My copyright'
        mock_song.book = MagicMock()
        mock_song.book.name = "My songbook"
        mock_song.song_number = 12
        service_item = ServiceItem(None)

        # WHEN: I generate the Footer with default settings
        self.media_item.generate_footer(service_item, mock_song)

        # THEN: The songbook should not be in the footer
        self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright'])

        # WHEN: I activate the "display songbook" option
        self.media_item.display_songbook = True
        self.media_item.generate_footer(service_item, mock_song)

        # THEN: The songbook should be in the footer
        self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'My songbook #12'])
开发者ID:crossroadchurch,项目名称:paul,代码行数:27,代码来源:test_mediaitem.py


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