test error message in python 3
<p>I have the following test method</p>

<pre><code>def test_fingerprintBadFormat(self):
    """
    A C{BadFingerPrintFormat} error is raised when unsupported
    formats are requested.
    """
    with self.assertRaises(keys.BadFingerPrintFormat) as em:
        keys.Key(self.rsaObj).fingerprint('sha256-base')
    self.assertEqual('Unsupported fingerprint format: sha256-base',
        em.exception.message)
</code></pre>

<p>Here is the exception class.</p>

<pre><code>class BadFingerPrintFormat(Exception):
    """
    Raises when unsupported fingerprint formats are presented to fingerprint.
    """
</code></pre>

<p>this test method works perfectly fine in Python2 but fails in python 3 with the following message</p>

<pre><code>builtins.AttributeError: 'BadFingerPrintFormat' object has no attribute 'message'
</code></pre>

<p>How can I test the error message in Python3. I don't like the idea of using <code>asserRaisesRegex</code> as it tests the regex rather than the exception message.</p>