| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 unittest | 6 import unittest |
| 7 from copy import deepcopy | 7 from copy import deepcopy |
| 8 | 8 |
| 9 from schema_util import RemoveNoDocs, DetectInlineableTypes, InlineDocs | 9 from schema_util import RemoveNoDocs, DetectInlineableTypes, InlineDocs |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 'type': 'string' | 163 'type': 'string' |
| 164 }, | 164 }, |
| 165 'type': 'array', | 165 'type': 'array', |
| 166 'id': 'KeyList', | 166 'id': 'KeyList', |
| 167 'description': 'A list of keys' | 167 'description': 'A list of keys' |
| 168 } | 168 } |
| 169 ] | 169 ] |
| 170 } | 170 } |
| 171 | 171 |
| 172 inlined_schema = deepcopy(schema) | 172 inlined_schema = deepcopy(schema) |
| 173 InlineDocs(inlined_schema) | 173 InlineDocs(inlined_schema, True) |
| 174 self.assertEqual(expected_schema, inlined_schema) | 174 self.assertEqual(expected_schema, inlined_schema) |
| 175 | 175 |
| 176 def testDetectInline(self): | 176 def testDetectInline(self): |
| 177 schema = { | 177 schema = { |
| 178 'types': [ | 178 'types': [ |
| 179 { | 179 { |
| 180 'id': 'Key', | 180 'id': 'Key', |
| 181 'items': { | 181 'items': { |
| 182 '$ref': 'Value' | 182 '$ref': 'Value' |
| 183 } | 183 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 194 { | 194 { |
| 195 'id': 'Key', | 195 'id': 'Key', |
| 196 'items': { | 196 'items': { |
| 197 'marker': True, | 197 'marker': True, |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 ] | 200 ] |
| 201 } | 201 } |
| 202 | 202 |
| 203 DetectInlineableTypes(schema) | 203 DetectInlineableTypes(schema) |
| 204 InlineDocs(schema) | 204 InlineDocs(schema, True) |
| 205 self.assertEqual(expected_schema, schema) | 205 self.assertEqual(expected_schema, schema) |
| 206 | 206 |
| 207 | 207 |
| 208 if __name__ == '__main__': | 208 if __name__ == '__main__': |
| 209 unittest.main() | 209 unittest.main() |
| OLD | NEW |