title: Python's assert_called_with, is there a wildcard character?
body: <p>Suppose I have a class in python set up like this.</p>
  
  <pre><code>from somewhere import sendmail
  
  class MyClass:
  
      def __init__(self, **kargs):
          self.sendmail = kwargs.get("sendmail", sendmail)  #if we can't find it, use imported def
  
      def publish():
  
          #lots of irrelevant code
          #and then
  
          self.sendmail(mail_to, mail_from, subject, body, format= 'html')
  </code></pre>
  
  <p>So as you can see, I have sort of given myself the option to parameterize which function I use for self.sendmail </p>
  
  <p>Now in the test file.</p>
  
  <pre><code>Class Tester():
  
      kwargs = {"sendmail": MagicMock(mail_from= None, mail_to= None, subject= None, body= None, format= None)}
      self.myclass = MyClass(**kwargs)
  
      ##later on
      def testDefaultEmailHeader():
  
          default_subject = "Hello World"
          self.myclass.publish()
  
          self.myclass.sendmail.assert_called()  #this is doing just fine
          self.myclass.sendmail.assert_called_with(default_subject)  #this is having issues
  </code></pre>
  
  <p>For some reason I am getting the error message</p>
  
  <pre><code>AssertionError: Expected call: mock('Hello World')
                  Actual Call : mock('defaultmt', 'defaultmf', 'Hello World', 'default_body', format= 'html')
  </code></pre>
  
  <p>So basically, the assert is expecting sendmail to be called with only one variable, when it ends up being called with all 5. The thing is, I don't care about what the other 4 variables are! I just want to make sure it is called with the correct subject.</p>
  
  <p>I tried the mock place holder ANY, and got the same thing</p>
  
  <pre><code>self.myclass.sendmail.assert_called_with(ANY, ANY, 'Hello World', ANY, ANY)
  
  AssertionError: Expected call: mock(&lt;ANY&gt;, &lt;ANY&gt;, 'Hello World', &lt;ANY&gt;, &lt;ANY&gt;)
  Actual Call : mock('defaultmt', 'defaultmf', 'Hello World', 'default_body, 'format= 'html') 
  </code></pre>
  
  <p>Really unsure on how to proceed with this one. Anyone have any advice if we only care about one of the variable and want to ignore the rest?</p>