Пример #1
0
    def test_process_calls_doProcess(self):
        processor = CanProcess()

        with patch.object(processor, "doProcess", create=True) as doProcessMock:
            processor.process(1.0)

        doProcessMock.assert_called_once_with(1.0)
    def test_process_calls_doProcess(self):
        processor = CanProcess()

        with patch.object(processor, 'doProcess', create=True) as doProcessMock:
            processor.process(1.0)

        doProcessMock.assert_called_once_with(1.0)
Пример #3
0
    def test_process_calls_doAfterProcess_only_if_doProcess_is_present(self):
        processor = CanProcess()

        with patch.object(processor, "doAfterProcess", create=True) as doAfterProcess:
            processor.process(1.0)

            doAfterProcess.assert_not_called()

            with patch.object(processor, "doProcess", create=True):
                processor.process(2.0)

            doAfterProcess.assert_called_once_with(2.0)
    def test_process_calls_doBeforeProcess_only_if_doProcess_is_present(self):
        processor = CanProcess()

        with patch.object(processor, 'doBeforeProcess', create=True) as doBeforeProcessMock:
            processor.process(1.0)

            doBeforeProcessMock.assert_not_called()

            with patch.object(processor, 'doProcess', create=True):
                processor.process(2.0)

            doBeforeProcessMock.assert_called_once_with(2.0)
    def test_process_calls_doAfterProcess_only_if_doProcess_is_present(self):
        processor = CanProcess()

        with patch.object(processor, 'doAfterProcess', create=True) as doAfterProcess:
            processor.process(1.0)

            doAfterProcess.assert_not_called()

            with patch.object(processor, 'doProcess', create=True):
                processor.process(2.0)

            doAfterProcess.assert_called_once_with(2.0)