summaryrefslogtreecommitdiff
path: root/testdata.json
diff options
context:
space:
mode:
authorAde Oshineye <adewale@gmail.com>2010-02-14 17:41:09 -0800
committerDavid Tsai <dbtsai@dbtsai.com>2012-08-22 14:32:30 -0700
commit032c52c6172856af88bbd5b7c59b3c1fb744421e (patch)
tree8fea3c2666a97a309759bdd6877cfa607cb339a0 /testdata.json
parentc3320d5a262c7698d00e6fcf3b89ab384287d626 (diff)
downloadpython-mimeparse-032c52c6172856af88bbd5b7c59b3c1fb744421e.tar.gz
Added the first set of language independent tests and a Python implementation.
The current tests are just a port of the existing Python tests but I plan to add more.
Diffstat (limited to 'testdata.json')
-rw-r--r--testdata.json34
1 files changed, 34 insertions, 0 deletions
diff --git a/testdata.json b/testdata.json
new file mode 100644
index 0000000..aea0c55
--- /dev/null
+++ b/testdata.json
@@ -0,0 +1,34 @@
+{
+"parse_media_range": [
+ ["application/xml;q=1", ["application", "xml", {"q": "1"}]],
+ ["application/xml", ["application", "xml", {"q": "1"}]],
+ ["application/xml;q=",["application", "xml", {"q": "1"}]],
+ ["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"}]],
+ [" *; q=.2",["*", "*", {"q": ".2"}]]
+],
+
+"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"], 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"], 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"], 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"], 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"], 0.7]
+],
+
+"best_match": [
+ [[["application/xbel+xml", "application/xml"], "application/xbel+xml"], "application/xbel+xml", "direct match"],
+ [[["application/xbel+xml", "application/xml"], "application/xbel+xml; q=1"], "application/xbel+xml", "direct match with a q parameter"],
+ [[["application/xbel+xml", "application/xml"], "application/xml; q=1"], "application/xml", "direct match of our second choice with a q parameter"],
+ [[["application/xbel+xml", "application/xml"], "application/*; q=1"], "application/xml", "match using a subtype wildcard"],
+ [[["application/xbel+xml", "application/xml"], "*/*", "application/xml"], "application/xml", "match using a type wildcard"],
+ [[["application/xbel+xml", "text/xml"], "text/*;q=0.5,*/*; q=0.1"], "text/xml", "match using a type versus a lower weighted subtype"],
+ [[["application/xbel+xml", "text/xml"], "text/html,application/atom+xml; q=0.9"], "", "fail to match anything"],
+ [[["application/json", "text/html"], "application/json, text/javascript, */*"], "application/json", "common AJAX scenario"],
+ [[["application/json", "text/html"], "application/json, text/html;q=0.9"], "application/json", "verify fitness ordering"],
+ [[["image/*", "application/xml"], "image/png"], "image/*", "match using a type wildcard"],
+ [[["image/*", "application/xml"], "image/*"], "image/*", "match using a wildcard for both requested and supported"]
+]
+} \ No newline at end of file