Fix bug in load time stats.
[chromium-blink-merge.git] / tools / json_schema_compiler / json_schema_test.py
blob860c5879b9d03f9cdfaba853f657d17a56b14bab
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
6 import json_schema
7 import json_schema_test
8 import unittest
10 class JsonSchemaUnittest(unittest.TestCase):
11 def testNocompile(self):
12 compiled = [
14 "namespace": "compile",
15 "functions": [],
16 "types": {}
20 "namespace": "functions",
21 "functions": [
23 "id": "two"
26 "id": "four"
30 "types": {
31 "one": { "key": "value" }
36 "namespace": "types",
37 "functions": [
38 { "id": "one" }
40 "types": {
41 "two": {
42 "key": "value"
44 "four": {
45 "key": "value"
51 "namespace": "nested",
52 "properties": {
53 "sync": {
54 "functions": [
56 "id": "two"
59 "id": "four"
62 "types": {
63 "two": {
64 "key": "value"
66 "four": {
67 "key": "value"
75 schema = json_schema.CachedLoad('test/json_schema_test.json')
76 self.assertEquals(compiled, json_schema.DeleteNocompileNodes(schema))
78 if __name__ == '__main__':
79 unittest.main()