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

def test_contains(self):

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