'Responses can be inspected for content, including counting repeated substrings'

def test_contains(self):

    response = self.client.get(u'/test_client_regress/no_template_view/')
    self.assertNotContains(response, u'never')
    self.assertContains(response, u'never', 0)
    self.assertContains(response, u'once')
    self.assertContains(response, u'once', 1)
    self.assertContains(response, u'twice')
    self.assertContains(response, u'twice', 2)
    try:
        self.assertContains(response, u'text', status_code=999)
    except AssertionError as e:
        self.assertIn(u"Couldn't    retrieve    content:    Response    code    was    200    (expected    999)", str(e))
    try:
        self.assertContains(response, u'text', status_code=999, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Couldn't    retrieve    content:    Response    code    was    200    (expected    999)", str(e))
    try:
        self.assertNotContains(response, u'text', status_code=999)
    except AssertionError as e:
        self.assertIn(u"Couldn't    retrieve    content:    Response    code    was    200    (expected    999)", str(e))
    try:
        self.assertNotContains(response, u'text', status_code=999, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Couldn't    retrieve    content:    Response    code    was    200    (expected    999)", str(e))
    try:
        self.assertNotContains(response, u'once')
    except AssertionError as e:
        self.assertIn(u"Response    should    not    contain    'once'", str(e))
    try:
        self.assertNotContains(response, u'once', msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Response    should    not    contain    'once'", str(e))
    try:
        self.assertContains(response, u'never', 1)
    except AssertionError as e:
        self.assertIn(u"Found    0    instances    of    'never'    in    response    (expected    1)", str(e))
    try:
        self.assertContains(response, u'never', 1, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Found    0    instances    of    'never'    in    response    (expected    1)", str(e))
    try:
        self.assertContains(response, u'once', 0)
    except AssertionError as e:
        self.assertIn(u"Found    1    instances    of    'once'    in    response    (expected    0)", str(e))
    try:
        self.assertContains(response, u'once', 0, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Found    1    instances    of    'once'    in    response    (expected    0)", str(e))
    try:
        self.assertContains(response, u'once', 2)
    except AssertionError as e:
        self.assertIn(u"Found    1    instances    of    'once'    in    response    (expected    2)", str(e))
    try:
        self.assertContains(response, u'once', 2, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Found    1    instances    of    'once'    in    response    (expected    2)", str(e))
    try:
        self.assertContains(response, u'twice', 1)
    except AssertionError as e:
        self.assertIn(u"Found    2    instances    of    'twice'    in    response    (expected    1)", str(e))
    try:
        self.assertContains(response, u'twice', 1, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Found    2    instances    of    'twice'    in    response    (expected    1)", str(e))
    try:
        self.assertContains(response, u'thrice')
    except AssertionError as e:
        self.assertIn(u"Couldn't    find    'thrice'    in    response", str(e))
    try:
        self.assertContains(response, u'thrice', msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Couldn't    find    'thrice'    in    response", str(e))
    try:
        self.assertContains(response, u'thrice', 3)
    except AssertionError as e:
        self.assertIn(u"Found    0    instances    of    'thrice'    in    response    (expected    3)", str(e))
    try:
        self.assertContains(response, u'thrice', 3, msg_prefix=u'abc')
    except AssertionError as e:
        self.assertIn(u"abc:    Found    0    instances    of    'thrice'    in    response    (expected    3)", str(e))
