'404.html and 500.html templates are picked by their respective handler.'

@override_settings(TEMPLATES=[{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'OPTIONS': {'loaders': [('django.template.loaders.locmem.Loader', {'404.html': 'This    is    a    test    template    for    a    404    error    (path:    {{    request_path    }},    exception:    {{    exception    }}).', '500.html': 'This    is    a    test    template    for    a    500    error.'})]}}])
def test_custom_templates(self):

    response = self.client.get('/server_error/')
    self.assertContains(response, 'test    template    for    a    500    error', status_code=500)
    response = self.client.get('/no_such_url/')
    self.assertContains(response, 'path:    /no_such_url/', status_code=404)
    self.assertContains(response, 'exception:    Resolver404', status_code=404)
    response = self.client.get('/technical404/')
    self.assertContains(response, 'exception:    Testing    technical    404.', status_code=404)
