title: Python unittest : how to specify custom equality predicate?
body: <p>This could be an easy question; I'd like to use a custom equality operator in a Python <code>unittest</code> test case. So for instance, supposing I want to test a "number-to-string" function, and I want to perform a case-insensitive string comparison. </p>
  
  <p>Here's what I'd like to write:</p>
  
  <pre><code>class MyTest(unittest.TestCase):
      def testFoo(self):
          self.assertCheck(ci_string_eq,i2s(24),"Twenty-Four")
  </code></pre>
  
  <p>The problem is that <code>assertCheck</code> isn't a thing.</p>
  
  <p>Some obvious workarounds:</p>
  
  <ul>
  <li>use assertTrue; the problem is that then a test case failure becomes opaque
  and unhelpful; "expected True, got False". Bleah.</li>
  <li>dig into unittest and extend it myself; well, I'm hoping to avoid that :)</li>
  </ul>
  
  <p>I hope I'm missing something obvious?</p>
  
  <p>Many thanks in advance!</p>
  
  <p>EDIT: some have suggested that I override <code>__eq__</code>. This is not what I want. Specifically, the <code>__eq__</code> method is used by clients of my code, to determine
  whether two objects should be considered "the same" (cf. "extensional equality").
  For the purposes of testing, though, I want to test using a different predicate.
  So overriding <code>__eq__</code> does not solve my problem.</p>