示例#1
0
 def test_language(self):
     r = Request({}, headers={'Accept-Language': 'en-gb;q=0.8, da'})
     bmatch = r.languages_best_match()
     assert ['da', 'en-gb'] == bmatch
示例#2
0
 def test_language_fallback_already_there(self):
     r = Request({}, headers={'Accept-Language': 'en-gb;q=0.8, it, da'})
     bmatch = r.languages_best_match(fallback='it')
     assert ['it'] == bmatch, bmatch
示例#3
0
 def test_language_fallback(self):
     r = Request({}, headers={'Accept-Language': 'en-gb;q=0.8, da'})
     bmatch = r.languages_best_match(fallback='it')
     assert ['da', 'en-gb', 'it'] == bmatch
示例#4
0
 def test_language(self):
     r = Request({}, headers={'Accept-Language': 'en-gb;q=0.8, da'})
     bmatch = r.languages_best_match()
     assert ['da', 'en-gb'] == bmatch
示例#5
0
 def test_language_fallback_already_there(self):
     r = Request({}, headers={'Accept-Language': 'en-gb;q=0.8, it, da'})
     bmatch = r.languages_best_match(fallback='it')
     assert bmatch[-1] == 'it', bmatch
示例#6
0
 def test_language_fallback(self):
     r = Request({}, headers={'Accept-Language': 'en-gb;q=0.8, da'})
     bmatch = r.languages_best_match(fallback='it')
     assert ['da', 'en-gb', 'it'] == bmatch