diff options
author | Stefan Wojcik <wojcikstefan@gmail.com> | 2016-10-16 18:39:42 -0400 |
---|---|---|
committer | Stefan Wojcik <wojcikstefan@gmail.com> | 2016-10-16 18:39:42 -0400 |
commit | 98494cd852addf0baeeb469c8d698f3d11f469d7 (patch) | |
tree | a10eebaf06aa05b4a8984ac0655f0c1bac8d3a7b | |
parent | 475dfb6911c784cb4a7377d203a4998d742d047f (diff) | |
parent | d87c40f7116c2f3ba0538d5eee465c2eec63c3f6 (diff) | |
download | python-mimeparse-98494cd852addf0baeeb469c8d698f3d11f469d7.tar.gz |
Merge branch 'master' of github.com:dbtsai/python-mimeparse into q-support-in-acceptable-types
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | __init__.py | 0 | ||||
-rw-r--r-- | mimeparse.py | 2 | ||||
-rwxr-xr-x | mimeparse_test.py | 13 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | testdata.json | 35 | ||||
-rw-r--r-- | tox.ini | 16 |
9 files changed, 53 insertions, 24 deletions
@@ -3,3 +3,5 @@ .tox *.egg-info dist/ +build/ +.venv/ diff --git a/.travis.yml b/.travis.yml index 20935de..cda7cc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,14 @@ python: env: - TOXENV=py27 - TOXENV=py34 - - TOXENV=pypy - TOXENV=pypy3 - - TOXENV=pep8,pyflakes + - TOXENV=flake8 # https://github.com/travis-ci/travis-ci/issues/4794 matrix: include: + - python: pypy-5.4 + env: TOXENV=pypy - python: 3.5 env: TOXENV=py35 diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/__init__.py +++ /dev/null diff --git a/mimeparse.py b/mimeparse.py index a38278a..ae942fa 100644 --- a/mimeparse.py +++ b/mimeparse.py @@ -1,6 +1,6 @@ import cgi -__version__ = '1.5.2' +__version__ = '1.5.5' __author__ = 'Joe Gregorio' __email__ = 'joe@bitworking.org' __license__ = 'MIT License' diff --git a/mimeparse_test.py b/mimeparse_test.py index 6d00238..da39312 100755 --- a/mimeparse_test.py +++ b/mimeparse_test.py @@ -6,9 +6,10 @@ This module loads a json file and converts the tests specified therein to a set of PyUnitTestCases. Then it uses PyUnit to run them and report their status. """ import json -import mimeparse import unittest +import mimeparse + __version__ = "0.1" __author__ = 'Ade Oshineye' @@ -36,15 +37,19 @@ class MimeParseTestCase(unittest.TestCase): def _test_best_match(self, args, expected, description): if expected is None: - self.assertRaises(mimeparse.MimeTypeParseException, mimeparse.best_match, args[0], args[1]) + self.assertRaises(mimeparse.MimeTypeParseException, + mimeparse.best_match, args[0], args[1]) else: result = mimeparse.best_match(args[0], args[1]) - message = "Expected: '%s' but got %s. Description for this test: %s" % (expected, result, description) + message = \ + "Expected: '%s' but got %s. Description for this test: %s" % \ + (expected, result, description) self.assertEqual(expected, result, message) def _test_parse_mime_type(self, args, expected): if expected is None: - self.assertRaises(mimeparse.MimeTypeParseException, mimeparse.parse_mime_type, args) + self.assertRaises(mimeparse.MimeTypeParseException, + mimeparse.parse_mime_type, args) else: expected = tuple(expected) result = mimeparse.parse_mime_type(args) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 @@ -1,7 +1,7 @@ #!/usr/bin/env python -import os import codecs +import os import re from setuptools import setup diff --git a/testdata.json b/testdata.json index 07ace39..0aafd05 100644 --- a/testdata.json +++ b/testdata.json @@ -15,31 +15,52 @@ "quality": [ [ - ["text/html;level=1", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], + [ + "text/html;level=1", + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" + ], 1 ], [ - ["text/html", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], + [ + "text/html", + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" + ], 0.7 ], [ - ["text/plain", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], + [ + "text/plain", + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" + ], 0.3 ], [ - ["image/jpeg", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], + [ + "image/jpeg", + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" + ], 0.5 ], [ - ["text/html;level=2", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], + [ + "text/html;level=2", + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" + ], 0.4 ], [ - ["text/html;level=3", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], + [ + "text/html;level=3", + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" + ], 0.7 ], [ - ["text/plain", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"], + [ + "text/plain", + "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + ], 0.2 ] ], @@ -1,8 +1,9 @@ [tox] -envlist = py35,py34,py32,py27,pypy,pypy3,pep8,pyflakes +envlist = py35,py34,py32,py27,pypy,pypy3,flake8 [testenv] -commands = ./mimeparse_test.py +commands = python --version + ./mimeparse_test.py [testenv:py35] basepython = python3.5 @@ -22,10 +23,7 @@ basepython = pypy [testenv:pypy3] basepython = pypy3 -[testenv:pep8] -deps = pep8 -commands = pep8 --statistics --show-source --ignore=E501 --exclude=.venv,.tox,*egg . - -[testenv:pyflakes] -deps = pyflakes -commands = pyflakes mimeparse.py mimeparse_test.py setup.py +[testenv:flake8] +deps = flake8 + flake8-import-order +commands = flake8 --statistics --show-source --ignore=E501 --exclude=.venv,.tox,*egg,*.egg-info,build,dist . |