Browse files

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...
1 parent 7cc2bf2 commit ef080e44d054fbabfe47ce51edd1fed78c9e60f4 @freakboy3742 freakboy3742 committed Jul 21, 2007
Showing with 1 addition and 1 deletion.
  1. +1 −1 django/test/testcases.py
View
2 django/test/testcases.py
@@ -84,7 +84,7 @@ def assertContains(self, response, text, count=None, status_code=200):
"Couldn't retrieve page: Response code was %d (expected %d)'" %
(response.status_code, status_code))
real_count = response.content.count(text)
- if count:
+ if count is not None:
self.assertEqual(real_count, count,
"Found %d instances of '%s' in response (expected %d)" % (real_count, text, count))
else:

0 comments on commit ef080e4

Please sign in to comment.