summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wojcik <wojcikstefan@gmail.com>2016-09-28 16:47:36 -0400
committerStefan Wojcik <wojcikstefan@gmail.com>2016-09-28 16:47:36 -0400
commitc1e74a7660a469525ca8b3e8324c98b71dcf512b (patch)
treee0ad0ff5b15fafe4fa9073ad11263985e1875a98
parent26f31ca9a4f354708f280e72fd06da5a32b984fe (diff)
downloadpython-mimeparse-c1e74a7660a469525ca8b3e8324c98b71dcf512b.tar.gz
more readable testdata.json
-rw-r--r--testdata.json230
1 files changed, 184 insertions, 46 deletions
diff --git a/testdata.json b/testdata.json
index 4f0a648..2609f6f 100644
--- a/testdata.json
+++ b/testdata.json
@@ -1,51 +1,189 @@
{
-"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",["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"}]],
- ["application/xml ; q=foo", ["application", "xml", {"q": "1"}]],
- ["application/xml ; Q=0.6", ["application", "xml", {"q": "0.6"}]],
- [" *; q=.2",["*", "*", {"q": ".2"}]]
-],
+ "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",["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"}]],
+ ["application/xml ; q=foo", ["application", "xml", {"q": "1"}]],
+ ["application/xml ; Q=0.6", ["application", "xml", {"q": "0.6"}]],
+ [" *; 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],
- [["text/plain", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"], 0.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
+ ],
+ [
+ ["text/plain", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"],
+ 0.2
+ ]
+ ],
-"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"],
- [[["image/jpeg", "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"], "image/jpeg", "media type with highest associated quality factor should win, not necessarily most specific"],
- [[["text/html", "application/rdf+xml"], "text/html, application/rdf+xml"], "application/rdf+xml", "match should use highest order of supported when there is a tie"],
- [[["application/rdf+xml", "text/html"], "text/html, application/rdf+xml"], "text/html", "match should use highest order of supported when there is a tie"],
- [[["application/json", "text/html"], "text"], null, "match should use the default if an invalid Accept header is passed"]
-],
+ "best_match": [
+ [
+ [
+ ["application/json", "text/html"],
+ "application/json, text/javascript, */*"
+ ],
+ "application/json",
+ "common AJAX scenario"
+ ],
+ [
+ [
+ ["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/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"
+ ],
+ [
+ [
+ ["image/jpeg", "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"
+ ],
+ "image/jpeg",
+ "media type with highest associated quality factor should win, not necessarily most specific"
+ ],
+ [
+ [
+ ["text/html", "application/rdf+xml"],
+ "text/html, application/rdf+xml"
+ ],
+ "application/rdf+xml",
+ "match should use highest order of supported when there is a tie"
+ ],
+ [
+ [
+ ["application/rdf+xml", "text/html"],
+ "text/html, application/rdf+xml"
+ ],
+ "text/html",
+ "match should use highest order of supported when there is a tie"
+ ],
+ [
+ [
+ ["application/json", "text/html"],
+ "text"
+ ],
+ null,
+ "match should use the default if an invalid Accept header is passed"
+ ]
+ ],
-"parse_mime_type": [
- ["application/xhtml;q=0.5", ["application", "xhtml", {"q": "0.5"}]],
- ["application/xhtml;q=0.5;ver=1.2", ["application", "xhtml", {"q": "0.5", "ver": "1.2"}]],
- ["application/xhtml;q=0.5;foo=\"bar quux\"", ["application", "xhtml", {"q": "0.5", "foo": "bar quux"}]],
- ["text", null],
- ["text/something/invalid", null]
-]
+ "parse_mime_type": [
+ [
+ "application/xhtml;q=0.5",
+ ["application", "xhtml", {"q": "0.5"}]
+ ],
+ [
+ "application/xhtml;q=0.5;ver=1.2",
+ ["application", "xhtml", {"q": "0.5", "ver": "1.2"}]
+ ],
+ [
+ "application/xhtml;q=0.5;foo=\"bar quux\"",
+ ["application", "xhtml", {"q": "0.5", "foo": "bar quux"}]],
+ [
+ "text", null
+ ],
+ [
+ "text/something/invalid", null
+ ]
+ ]
}