2 # Copyright 2013 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.
7 from copy import deepcopy
9 from schema_util import RemoveNoDocs, DetectInlineableTypes, InlineDocs
12 class SchemaUtilTest(unittest.TestCase):
14 def testRemoveNoDocs(self):
109 RemoveNoDocs(nodoc_data)
110 self.assertEquals(expected_nodoc, nodoc_data)
112 def testInlineDocs(self):
114 'namespace': 'storage',
117 'description': 'second key',
121 'description': 'first key',
129 'id': 'Key', # Should be inlined into both properties and be removed
131 'description': 'This is a key.', # This description should disappear.
132 'marker': True # This should appear three times in the output.
140 'description': 'A list of keys'
146 'namespace': 'storage',
151 'description': 'second key'
156 'description': 'first key'
167 'description': 'A list of keys'
172 inlined_schema = deepcopy(schema)
173 InlineDocs(inlined_schema, False)
174 self.assertEqual(expected_schema, inlined_schema)
176 def testDetectInline(self):
203 DetectInlineableTypes(schema)
204 InlineDocs(schema, False)
205 self.assertEqual(expected_schema, schema)
208 if __name__ == '__main__':