title: Magic mock assert_called_once vs assert_called_once_with weird behaviour
body: <p>I am noticing a weird behavior with <code>assert_called_once</code> and <code>assert_called_once_with</code> in python. This is my real simple test:</p>
  <p>File module/a.py</p>
  <pre><code>from .b import B
  
  class A(object):
      def __init__(self):
          self.b = B(&quot;hi&quot;)
  
      def call_b_hello(self):
          print(self.b.hello())
  </code></pre>
  <p>File module/b.py</p>
  <pre><code>class B(object):
      def __init__(self, string):
          print(&quot;created B&quot;)
          self.string = string;
  
      def hello(self):
          return self.string
  </code></pre>
  <p>These are my tests:</p>
  <pre><code>import unittest
  from mock import patch
  from module.a import A    
  
  class MCVETests(unittest.TestCase):
      @patch('module.a.B')   
      def testAcallBwithMockPassCorrect(self, b1):
          a = A()
          b1.assert_called_once_with(&quot;hi&quot;)
          a.call_b_hello()
          a.b.hello.assert_called_once()
  
      @patch('module.a.B')
      def testAcallBwithMockPassCorrectWith(self, b1):
          a = A()
          b1.assert_called_once_with(&quot;hi&quot;)
          a.call_b_hello()
          a.b.hello.assert_called_once_with()
  
      @patch('module.a.B')
      def testAcallBwithMockFailCorrectWith(self, b1):
          a = A()
          b1.assert_called_once_with(&quot;hi&quot;)
          a.b.hello.assert_called_once_with()
  
      @patch('module.a.B')
      def testAcallBwithMockPassWrong(self, b1):
          a = A()
          b1.assert_called_once_with(&quot;hi&quot;)
          a.b.hello.assert_called_once()
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  <p>My problem as stated in the name of the function is:</p>
  <ul>
  <li>Test 1 passes correctly</li>
  <li>Test 2 passes correctly</li>
  <li>Test 3 fails correctly (I've removed the call to b)</li>
  <li>Test 4 passes I am not sure why.</li>
  </ul>
  <p>Am I doing something wrong? I am not sure but reading the documentation <a href="https://docs.python.org/3/library/unittest.mock.html" rel="noreferrer">docs python</a>:</p>
  <blockquote>
  <p>assert_called_once(*args, **kwargs)</p>
  <p>Assert that the mock was called exactly once.</p>
  </blockquote>