Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Committed missing file from [6608].

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6612 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a14256aade963929743aa09e0834f5fc4072f772 1 parent 842a771
Jacob Kaplan-Moss authored October 26, 2007

Showing 1 changed file with 57 additions and 0 deletions. Show diff stats Hide diff stats

  1. 57  tests/regressiontests/i18n/misc.py
57  tests/regressiontests/i18n/misc.py
... ...
@@ -0,0 +1,57 @@
  1
+tests = """
  2
+>>> from django.utils.translation.trans_real import parse_accept_lang_header
  3
+>>> p = parse_accept_lang_header
  4
+
  5
+Good headers.
  6
+>>> p('de')
  7
+[('de', 1.0)]
  8
+>>> p('en-AU')
  9
+[('en-AU', 1.0)]
  10
+>>> p('*;q=1.00')
  11
+[('*', 1.0)]
  12
+>>> p('en-AU;q=0.123')
  13
+[('en-AU', 0.123)]
  14
+>>> p('en-au;q=0.1')
  15
+[('en-au', 0.10000000000000001)]
  16
+>>> p('en-au;q=1.0')
  17
+[('en-au', 1.0)]
  18
+>>> p('da, en-gb;q=0.25, en;q=0.5')
  19
+[('da', 1.0), ('en', 0.5), ('en-gb', 0.25)]
  20
+>>> p('en-au-xx')
  21
+[('en-au-xx', 1.0)]
  22
+>>> p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125')
  23
+[('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)]
  24
+>>> p('*')
  25
+[('*', 1.0)]
  26
+>>> p('de;q=0.')
  27
+[('de', 1.0)]
  28
+>>> p('')
  29
+[]
  30
+
  31
+Bad headers; should always return [].
  32
+>>> p('en-gb;q=1.0000')
  33
+[]
  34
+>>> p('en;q=0.1234')
  35
+[]
  36
+>>> p('en;q=.2')
  37
+[]
  38
+>>> p('abcdefghi-au')
  39
+[]
  40
+>>> p('**')
  41
+[]
  42
+>>> p('en,,gb')
  43
+[]
  44
+>>> p('en-au;q=0.1.0')
  45
+[]
  46
+>>> p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en')
  47
+[]
  48
+>>> p('da, en-gb;q=0.8, en;q=0.7,#')
  49
+[]
  50
+>>> p('de;q=2.0')
  51
+[]
  52
+>>> p('de;q=0.a')
  53
+[]
  54
+>>> p('')
  55
+[]
  56
+
  57
+"""

0 notes on commit a14256a

Please sign in to comment.
Something went wrong with that request. Please try again.