Testing for a ValidationError in Django
<p>If I have a model called <code>Enquiry</code> with an attribute of <code>email</code> how might I check that creating an Enquiry with an invalid email raises an error?</p>

<p>I have tried this</p>

<pre><code>def test_email_is_valid(self):
    self.assertRaises(ValidationError, Enquiry.objects.create(email="testtest.com"))
</code></pre>

<p>However I get the Error</p>

<blockquote>
  <p>TypeError: 'Enquiry' object is not callable</p>
</blockquote>

<p>I'm not quite getting something, does anybody know the correct method to test for email validation?</p>