Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Minor fix to allow for count=0 in assertContains.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ef080e44d054fbabfe47ce51edd1fed78c9e60f4 1 parent 7cc2bf2
Russell Keith-Magee authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  django/test/testcases.py
2  django/test/testcases.py
@@ -84,7 +84,7 @@ def assertContains(self, response, text, count=None, status_code=200):
84 84
             "Couldn't retrieve page: Response code was %d (expected %d)'" % 
85 85
                 (response.status_code, status_code))
86 86
         real_count = response.content.count(text)
87  
-        if count:
  87
+        if count is not None:
88 88
             self.assertEqual(real_count, count,
89 89
                 "Found %d instances of '%s' in response (expected %d)" % (real_count, text, count))
90 90
         else:

0 notes on commit ef080e4

Please sign in to comment.
Something went wrong with that request. Please try again.