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


Python mockito.verify函数代码示例

本文整理汇总了Python中mockito.verify函数的典型用法代码示例。如果您正苦于以下问题:Python verify函数的具体用法?Python verify怎么用?Python verify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_catches_exceptions_to_not_break_other_listeners

    def test_catches_exceptions_to_not_break_other_listeners(self):
        when(logger).error(ANY()).thenReturn(None)
        listener = MailboxIndexerListener('INBOX', self.mail_store, mock())

        yield listener.notify_new()

        verify(logger).error(ANY())
开发者ID:Josue23,项目名称:pixelated-user-agent,代码行数:7,代码来源:test_mailbox_indexer_listener.py

示例2: testVerifiesMultipleCallsOnClassmethod

    def testVerifiesMultipleCallsOnClassmethod(self):
        when(Dog).bark().thenReturn("miau!")

        Dog.bark()
        Dog.bark()

        verify(Dog, times=2).bark()
开发者ID:kaste,项目名称:mockito-python,代码行数:7,代码来源:classmethods_test.py

示例3: test_should_raise_exception_when_loading_project_module_and_import_raises_exception

    def test_should_raise_exception_when_loading_project_module_and_import_raises_exception(self):
        when(imp).load_source("build", "spam").thenRaise(ImportError("spam"))

        self.assertRaises(
            PyBuilderException, self.reactor.load_project_module, "spam")

        verify(imp).load_source("build", "spam")
开发者ID:Ferreiros-lab,项目名称:pybuilder,代码行数:7,代码来源:reactor_tests.py

示例4: test_transfert_debite_le_bon_compte

    def test_transfert_debite_le_bon_compte(self):
        """Test si lors du transfert la valeur est bien debitee de la source"""

        amount = 100
        when(self.accountDest).can_accept_credit(amount).thenReturn(True)
        self.transfer.transfer(amount)
        verify(self.accountSrc, times=1).debit(amount)
开发者ID:BenjaminVanRyseghem,项目名称:SVL,代码行数:7,代码来源:test_bank.py

示例5: test_transfert_credite_et_debite_de_la_meme_valeur

 def test_transfert_credite_et_debite_de_la_meme_valeur(self):  
     """Test que lors d'un transfert la valeur debitee et creditee est la meme"""  
     amount = 100
     when(self.accountDest).can_accept_credit(amount).thenReturn(True)
     self.transfer.transfer(amount)
     verify(self.accountDest, times=1).credit(amount)
     verify(self.accountSrc, times=1).debit(amount)
开发者ID:BenjaminVanRyseghem,项目名称:SVL,代码行数:7,代码来源:test_bank.py

示例6: test_rotateMap

 def test_rotateMap(self):
     """
     load the next map/level
     """
     with patch("time.sleep"):
         self.console.rotateMap()
     verify(self.output_mock).write('cyclemap')
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:7,代码来源:test_iourt41.py

示例7: test_should_only_match_py_files_regardless_of_glob

 def test_should_only_match_py_files_regardless_of_glob(self):
     when(os).walk("pet_shop").thenReturn([("pet_shop", [],
                                            ["parrot.txt", "parrot.py", "parrot.pyc", "parrot.py~", "slug.py"])])
     expected_result = ["parrot"]
     actual_result = discover_modules_matching("pet_shop", "*parrot*")
     self.assertEquals(set(expected_result), set(actual_result))
     verify(os).walk("pet_shop")
开发者ID:AnudeepHemachandra,项目名称:pybuilder,代码行数:7,代码来源:utils_tests.py

示例8: test_find_with_link_synonym

 def test_find_with_link_synonym(self):
     finder = ElementFinder()
     browser = mock()
     when(browser).get_current_url().thenReturn("http://localhost/mypage.html")
     finder.find(browser, "test1", tag='link')
     verify(browser).find_elements_by_xpath(
         "//a[(@id='test1' or @name='test1' or @href='test1' or normalize-space(descendant-or-self::text())='test1' or @href='http://localhost/test1')]")
开发者ID:Gaurang033,项目名称:Selenium2Library,代码行数:7,代码来源:test_elementfinder.py

示例9: test_find_with_img

 def test_find_with_img(self):
     finder = ElementFinder()
     browser = mock()
     when(browser).get_current_url().thenReturn("http://localhost/mypage.html")
     finder.find(browser, "test1", tag='img')
     verify(browser).find_elements_by_xpath(
         "//img[(@id='test1' or @name='test1' or @src='test1' or @alt='test1' or @src='http://localhost/test1')]")
开发者ID:Gaurang033,项目名称:Selenium2Library,代码行数:7,代码来源:test_elementfinder.py

示例10: test_delete_backup_fail_delete_segment

 def test_delete_backup_fail_delete_segment(self):
     when(self.swift_client).delete_object(any(), "second").thenRaise(ClientException("foo"))
     self.assertRaises(TroveError, taskmanager_models.BackupTasks.delete_backup, "dummy context", self.backup.id)
     verify(backup_models.Backup, never).delete(self.backup.id)
     self.assertEqual(
         backup_models.BackupState.DELETE_FAILED, self.backup.state, "backup should be in DELETE_FAILED status"
     )
开发者ID:NeCTAR-RC,项目名称:trove,代码行数:7,代码来源:test_models.py

示例11: test_find_with_text_field_synonym

 def test_find_with_text_field_synonym(self):
     finder = ElementFinder()
     browser = mock()
     when(browser).get_current_url().thenReturn("http://localhost/mypage.html")
     finder.find(browser, "test1", tag='text field')
     verify(browser).find_elements_by_xpath(
         "//input[@type='text' and (@id='test1' or @name='test1' or @value='test1' or @src='test1' or @src='http://localhost/test1')]")
开发者ID:Gaurang033,项目名称:Selenium2Library,代码行数:7,代码来源:test_elementfinder.py

示例12: testReconfigureStrictMock

    def testReconfigureStrictMock(self):
        when(Dog).bark()  # important first call, inits theMock

        when(Dog, strict=False).waggle().thenReturn('Sure')
        expect(Dog, strict=False).weggle().thenReturn('Sure')


        with pytest.raises(InvocationError):
            when(Dog).wuggle()

        with pytest.raises(InvocationError):
            when(Dog).woggle()

        rex = Dog()
        assert rex.waggle() == 'Sure'
        assert rex.weggle() == 'Sure'

        # For documentation; the inital strict value of the mock will be used
        # here. So the above when(..., strict=False) just assures we can
        # actually *add* an attribute to the mocked object
        with pytest.raises(InvocationError):
            rex.waggle(1)

        verify(Dog).waggle()
        verify(Dog).weggle()
开发者ID:kaste,项目名称:mockito-python,代码行数:25,代码来源:when_interface_test.py

示例13: testSpy2

    def testSpy2(self):
        spy2('os.path.exists')

        import os.path
        assert not os.path.exists('/Foo')

        verify('os.path', times=1).exists('/Foo')
开发者ID:kaste,项目名称:mockito-python,代码行数:7,代码来源:when_interface_test.py

示例14: testVerify

    def testVerify(self):
        when('os.path').exists('/Foo').thenReturn(True)

        import os.path
        os.path.exists('/Foo')

        verify('os.path', times=1).exists('/Foo')
开发者ID:kaste,项目名称:mockito-python,代码行数:7,代码来源:when_interface_test.py

示例15: test_say

 def test_say(self):
     """
     broadcast a message to all players
     """
     self.console.msgPrefix = "B3:"
     self.console.say("something")
     verify(self.output_mock).write('say B3: something')
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:7,代码来源:test_iourt41.py


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