Ticket #13615: testcase_msg.diff

File testcase_msg.diff, 2.1 KB (added by Daniel Duan, 14 years ago)

Replace "page" with "content" in the assertContains failure msg.

  • django/test/testcases.py

    diff --git a/django/test/testcases.py b/django/test/testcases.py
    index 2f8acad..6eca030 100644
    a b class TransactionTestCase(unittest.TestCase):  
    347347    def assertContains(self, response, text, count=None, status_code=200,
    348348                       msg_prefix=''):
    349349        """
    350         Asserts that a response indicates that a page was retrieved
     350        Asserts that a response indicates that a page/content was retrieved
    351351        successfully, (i.e., the HTTP status code was as expected), and that
    352352        ``text`` occurs ``count`` times in the content of the response.
    353353        If ``count`` is None, the count doesn't matter - the assertion is true
    class TransactionTestCase(unittest.TestCase):  
    357357            msg_prefix += ": "
    358358
    359359        self.assertEqual(response.status_code, status_code,
    360             msg_prefix + "Couldn't retrieve page: Response code was %d"
     360            msg_prefix + "Couldn't retrieve content: Response code was %d"
    361361            " (expected %d)" % (response.status_code, status_code))
    362362        text = smart_str(text, response._charset)
    363363        real_count = response.content.count(text)
    class TransactionTestCase(unittest.TestCase):  
    372372    def assertNotContains(self, response, text, status_code=200,
    373373                          msg_prefix=''):
    374374        """
    375         Asserts that a response indicates that a page was retrieved
     375        Asserts that a response indicates that a page/content was retrieved
    376376        successfully, (i.e., the HTTP status code was as expected), and that
    377377        ``text`` doesn't occurs in the content of the response.
    378378        """
    class TransactionTestCase(unittest.TestCase):  
    380380            msg_prefix += ": "
    381381
    382382        self.assertEqual(response.status_code, status_code,
    383             msg_prefix + "Couldn't retrieve page: Response code was %d"
     383            msg_prefix + "Couldn't retrieve content: Response code was %d"
    384384            " (expected %d)" % (response.status_code, status_code))
    385385        text = smart_str(text, response._charset)
    386386        self.assertEqual(response.content.count(text), 0,
Back to Top