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.
9 class JsonSchemaUnittest(unittest
.TestCase
):
10 def testNocompile(self
):
13 "namespace": "compile",
14 "description": "The compile API.",
20 "namespace": "functions",
21 "description": "The functions API.",
32 "one": { "key": "value" }
38 "description": "The types API.",
53 "namespace": "nested",
54 "description": "The nested API.",
78 schema
= json_schema
.CachedLoad('test/json_schema_test.json')
79 self
.assertEquals(compiled
, json_schema
.DeleteNodes(schema
, 'nocompile'))
81 def should_delete(value
):
82 return isinstance(value
, dict) and not value
.get('valid', True)
84 {'one': {'test': 'test'}},
89 {'one': {'test': 'test'}, 'two': {'valid': False}},
95 expected
, json_schema
.DeleteNodes(given
, matcher
=should_delete
))
98 if __name__
== '__main__':