diff options
| author | Graham Higgins <gjh-github@bel-epa.com> | 2012-05-12 17:59:13 +0100 |
|---|---|---|
| committer | Graham Higgins <gjh-github@bel-epa.com> | 2012-05-12 17:59:13 +0100 |
| commit | 6c55f822049b582ada1f53bb39bc345cc0a3723c (patch) | |
| tree | 91914a3c11de8a9be9a6e626af16ff8f5d45d5af /tests/test_acceptparse.py | |
| parent | 600b1ca5a7af9cba795bf5cbf872b88a868ef6be (diff) | |
| download | webob-6c55f822049b582ada1f53bb39bc345cc0a3723c.tar.gz | |
Fix acceptparse __str__'s rounding of q values
Diffstat (limited to 'tests/test_acceptparse.py')
| -rw-r--r-- | tests/test_acceptparse.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_acceptparse.py b/tests/test_acceptparse.py index 43869da..007c7ad 100644 --- a/tests/test_acceptparse.py +++ b/tests/test_acceptparse.py @@ -139,6 +139,16 @@ def test_best_match_with_one_lower_q(): assert accept.best_match(['text/html', 'foo/bar']) == 'foo/bar' +def test_best_match_with_complex_q(): + accept = Accept('text/html, foo/bar;q=0.55, baz/gort;q=0.59') + assert accept.best_match(['text/html', 'foo/bar']) == 'text/html' + accept = Accept('text/html;q=0.5, foo/bar;q=0.586, baz/gort;q=0.5966') + assert "baz/gort;q=0.597" in str(accept) + assert "foo/bar;q=0.586" in str(accept) + assert "text/html;q=0.5" in str(accept) + assert accept.best_match(['text/html', 'baz/gort']) == 'baz/gort' + + def test_accept_match(): for mask in ['*', 'text/html', 'TEXT/HTML']: assert 'text/html' in Accept(mask) |
