diff options
author | Ade Oshineye <adewale@gmail.com> | 2010-02-15 17:52:29 -0800 |
---|---|---|
committer | David Tsai <dbtsai@dbtsai.com> | 2012-08-22 14:39:17 -0700 |
commit | 7d9fecd71d687ee61bbc055d5b5026a2d36d02d5 (patch) | |
tree | b63e06f8451810fbf68b1d84ae6853a25f83327a /mimeparse_test.py | |
parent | bb1cbb2aa586d3ac74a21148a03c207d18a64262 (diff) | |
download | python-mimeparse-7d9fecd71d687ee61bbc055d5b5026a2d36d02d5.tar.gz |
Added tests for parse_mime_type. One came from the docstring for the Python
function. The other came from the test for the Go function. Updated the README
file to describe the structure of the test data.
Diffstat (limited to 'mimeparse_test.py')
-rw-r--r-- | mimeparse_test.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mimeparse_test.py b/mimeparse_test.py index 8de2d8c..ee193c3 100644 --- a/mimeparse_test.py +++ b/mimeparse_test.py @@ -34,6 +34,12 @@ def test_best_match(args, expected): message = "Expected: '%s' but got %s" % (expected, result) assert expected == result, message +def test_parse_mime_type(args, expected): + expected = tuple(expected) + result = mimeparse.parse_mime_type(args) + message = "Expected: '%s' but got %s" % (expected, result) + assert expected == result, message + def add_tests(suite, json_object, func_name, test_func): test_data = json_object[func_name] for test_datum in test_data: @@ -52,6 +58,7 @@ def run_tests(): add_tests(suite, json_object, "parse_media_range", test_parse_media_range) add_tests(suite, json_object, "quality", test_quality) add_tests(suite, json_object, "best_match", test_best_match) + add_tests(suite, json_object, "parse_mime_type", test_parse_mime_type) test_runner = unittest.TextTestRunner(verbosity=1) test_runner.run(suite) |