OLD | NEW |
(Empty) | |
| 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. |
| 5 |
| 6 from json_schema import CachedLoad |
| 7 import json_schema_test |
| 8 import unittest |
| 9 |
| 10 class JsonSchemaUnittest(unittest.TestCase): |
| 11 def testNocompile(self): |
| 12 compiled = [ |
| 13 { |
| 14 "namespace": "compile", |
| 15 "functions": [], |
| 16 "types": {} |
| 17 }, |
| 18 |
| 19 { |
| 20 "namespace": "functions", |
| 21 "functions": [ |
| 22 { |
| 23 "id": "two" |
| 24 }, |
| 25 { |
| 26 "id": "four" |
| 27 } |
| 28 ], |
| 29 |
| 30 "types": { |
| 31 "one": { "key": "value" } |
| 32 } |
| 33 }, |
| 34 |
| 35 { |
| 36 "namespace": "types", |
| 37 "functions": [ |
| 38 { "id": "one" } |
| 39 ], |
| 40 "types": { |
| 41 "two": { |
| 42 "key": "value" |
| 43 }, |
| 44 "four": { |
| 45 "key": "value" |
| 46 } |
| 47 } |
| 48 }, |
| 49 |
| 50 { |
| 51 "namespace": "nested", |
| 52 "properties": { |
| 53 "sync": { |
| 54 "functions": [ |
| 55 { |
| 56 "id": "two" |
| 57 }, |
| 58 { |
| 59 "id": "four" |
| 60 } |
| 61 ], |
| 62 "types": { |
| 63 "two": { |
| 64 "key": "value" |
| 65 }, |
| 66 "four": { |
| 67 "key": "value" |
| 68 } |
| 69 } |
| 70 } |
| 71 } |
| 72 } |
| 73 ] |
| 74 |
| 75 self.assertEquals(compiled, CachedLoad('test/json_schema_test.json')) |
| 76 |
| 77 if __name__ == '__main__': |
| 78 unittest.main() |
OLD | NEW |