diff options
| -rw-r--r-- | .travis.yml | 1 | ||||
| -rwxr-xr-x | mimeparse.py | 5 | ||||
| -rw-r--r-- | testdata.json | 1 | ||||
| -rw-r--r-- | tox.ini | 8 |
4 files changed, 4 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml index 7780b1a..7d3901c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ python: - "2.7" env: - - TOXENV=py26 - TOXENV=py27 - TOXENV=py32 - TOXENV=pypy diff --git a/mimeparse.py b/mimeparse.py index 9f9a2c1..181e01f 100755 --- a/mimeparse.py +++ b/mimeparse.py @@ -66,8 +66,7 @@ def parse_media_range(range): """ (type, subtype, params) = parse_mime_type(range) if not 'q' in params or not params['q'] or \ - not float(params['q']) or float(params['q']) > 1\ - or float(params['q']) < 0: + float(params['q']) > 1 or float(params['q']) < 0: params['q'] = '1' return (type, subtype, params) @@ -95,7 +94,7 @@ def fitness_and_quality_parsed(mime_type, parsed_ranges): target_subtype == '*') if type_match and subtype_match: param_matches = reduce(lambda x, y: x + y, [1 for (key, value) in - list(target_params.items()) if key != 'q' and + target_params.items() if key != 'q' and key in params and value == params[key]], 0) fitness = (type == target_type) and 100 or 0 fitness += (subtype == target_subtype) and 10 or 0 diff --git a/testdata.json b/testdata.json index 8f28b30..c44ea85 100644 --- a/testdata.json +++ b/testdata.json @@ -6,6 +6,7 @@ ["application/xml ;q=",["application", "xml", {"q": "1"}]], ["application/xml ; q=1;b=other",["application", "xml", {"q": "1", "b":"other"}]], ["application/xml ; q=2;b=other",["application", "xml", {"q": "1", "b":"other"}]], + ["application/xml ; q=0",["application", "xml", {"q": "0"}]], [" *; q=.2",["*", "*", {"q": ".2"}]] ], @@ -1,21 +1,15 @@ [tox] -envlist = py33,py32,py27,py26,pypy,pep8,pyflakes +envlist = py32,py27,pypy,pep8,pyflakes [testenv] commands = ./mimeparse_test.py -[testenv:py33] -basepython = python3.3 - [testenv:py32] basepython = python3.2 [testenv:py27] basepython = python2.7 -[testenv:py26] -basepython = python2.6 - [testenv:pypy] basepython = pypy |
