Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/json_schema_compiler/json_schema_test.py

Issue 16876004: Updating JSON Schema Compiler to add description field to schemas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (kalman) rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/model.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import json_schema 6 import json_schema
7 import json_schema_test 7 import json_schema_test
8 import unittest 8 import unittest
9 9
10 class JsonSchemaUnittest(unittest.TestCase): 10 class JsonSchemaUnittest(unittest.TestCase):
11 def testNocompile(self): 11 def testNocompile(self):
12 compiled = [ 12 compiled = [
13 { 13 {
14 "namespace": "compile", 14 "namespace": "compile",
15 "description": "The compile API.",
15 "functions": [], 16 "functions": [],
16 "types": {} 17 "types": {}
17 }, 18 },
18 19
19 { 20 {
20 "namespace": "functions", 21 "namespace": "functions",
22 "description": "The functions API.",
21 "functions": [ 23 "functions": [
22 { 24 {
23 "id": "two" 25 "id": "two"
24 }, 26 },
25 { 27 {
26 "id": "four" 28 "id": "four"
27 } 29 }
28 ], 30 ],
29 31
30 "types": { 32 "types": {
31 "one": { "key": "value" } 33 "one": { "key": "value" }
32 } 34 }
33 }, 35 },
34 36
35 { 37 {
36 "namespace": "types", 38 "namespace": "types",
39 "description": "The types API.",
37 "functions": [ 40 "functions": [
38 { "id": "one" } 41 { "id": "one" }
39 ], 42 ],
40 "types": { 43 "types": {
41 "two": { 44 "two": {
42 "key": "value" 45 "key": "value"
43 }, 46 },
44 "four": { 47 "four": {
45 "key": "value" 48 "key": "value"
46 } 49 }
47 } 50 }
48 }, 51 },
49 52
50 { 53 {
51 "namespace": "nested", 54 "namespace": "nested",
55 "description": "The nested API.",
52 "properties": { 56 "properties": {
53 "sync": { 57 "sync": {
54 "functions": [ 58 "functions": [
55 { 59 {
56 "id": "two" 60 "id": "two"
57 }, 61 },
58 { 62 {
59 "id": "four" 63 "id": "four"
60 } 64 }
61 ], 65 ],
62 "types": { 66 "types": {
63 "two": { 67 "two": {
64 "key": "value" 68 "key": "value"
65 }, 69 },
66 "four": { 70 "four": {
67 "key": "value" 71 "key": "value"
68 } 72 }
69 } 73 }
70 } 74 }
71 } 75 }
72 } 76 }
73 ] 77 ]
74 78
75 schema = json_schema.CachedLoad('test/json_schema_test.json') 79 schema = json_schema.CachedLoad('test/json_schema_test.json')
76 self.assertEquals(compiled, json_schema.DeleteNodes(schema, 'nocompile')) 80 self.assertEquals(compiled, json_schema.DeleteNodes(schema, 'nocompile'))
77 81
78 if __name__ == '__main__': 82 if __name__ == '__main__':
79 unittest.main() 83 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/model.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698