Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit ef080e44d054fbabfe47ce51edd1fed78c9e60f4 1 parent 7cc2bf2
@freakboy3742 freakboy3742 authored
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:
Please sign in to comment.
Something went wrong with that request. Please try again.