'Now test that we parse a literal HTTP header correctly.'

def test_parse_literal_http_header(self):

    from django.utils.translation.trans_real import get_language_from_request
    g = get_language_from_request
    from django.http import HttpRequest
    r = HttpRequest
    r.COOKIES = {}
    r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
    self.assertEqual('pt-br', g(r))
    r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
    self.assertEqual('pt', g(r))
    r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
    self.assertEqual('es', g(r))
    r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
    self.assertEqual('es-ar', g(r))
    if (sys.version_info >= (2, 5)):
        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
        self.assertEqual(g(r), 'es')
    r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
    self.assertEqual(g(r), 'zh-cn')
