title: Mocks not getting hit in Python unit tests
body: <p>I'm new to Python, but I've done quite a bit of unit testing in C# and JavaScript. I'm having trouble figuring out the mocking framework in Python. Here's what I have (trimmed down):</p>
  
  <p><strong>invoice_business.py</strong></p>
  
  <pre><code>import ims.repository.invoice_repository as invoiceRepository
  import logging
  
  logger = logging.getLogger(__name__)
  
  def update_invoice_statuses(invoices):
      for invoice in invoices:
          dbInvoice = invoiceRepository.get(invoice.invoice_id)
          print("dbInvoice is %s" % dbInvoice) #prints &lt;MagicMock etc.&gt;
  
          if dbInvoice is None:
              logger.error("Unable to update status for invoice %d" % invoice.invoice_id)
              continue;
  </code></pre>
  
  <p><strong>test_invoice_business.py</strong></p>
  
  <pre><code>from unittest import TestCase, mock
  import logging
  import ims.business.invoice_business as business
  
  class UpdateInvoiceTests(TestCase):
      @mock.patch("ims.business.invoice_business.invoiceRepository")
      @mock.patch("ims.business.invoice_business.logger")
      def test_invoiceDoesNotExist_logsErrorAndContinues(self, invoiceRepoMock, loggerMock):
          #Arrange
          invoice = Invoice(123)
          invoice.set_status(InvoiceStatus.Filed, None)
          invoiceRepoMock.get.return_value(33)
  
          #Act
          business.update_invoice_statuses([invoice])
  
          #Assert
          invoiceRepoMock.get.assert_called_once_with(123)
          loggerMock.error.assert_called_once_with("Unable to update status for invoice 123")
  </code></pre>
  
  <p>The test fails with </p>
  
  <blockquote>
    <p>AssertionError: Expected 'get' to be called once. Called 0 times.</p>
  </blockquote>
  
  <p>The <code>print</code> statement in <code>update_invoice_statuses</code> gets hit, though, because I see the output of</p>
  
  <pre><code>dbInvoice is &lt;MagicMock name='invoiceRepository.get()' id='xxxx'&gt;
  </code></pre>
  
  <p>Any idea what I'm doing wrong here?</p>
  
  <p><strong>Edit</strong>: After @chepner's help, I ran into another assertion error and realized it was because I should be using <code>invoiceRepoMock.get.return_value = None</code> rather than <code>.return_value(None)</code></p>