Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tools/json_schema_compiler/idl_schema_test.py

Issue 1051563002: Support JSON Schema properties with values in the JSON Schema Compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: assertr Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 idl_schema 6 import idl_schema
7 import unittest 7 import unittest
8 8
9 from json_parse import OrderedDict 9 from json_parse import OrderedDict
10 10
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 'type': 'function', 'name': 'callback', 'parameters': [{ 384 'type': 'function', 'name': 'callback', 'parameters': [{
385 'name': 'x', 'optional': True, 'choices': [ 385 'name': 'x', 'optional': True, 'choices': [
386 {'type': 'integer'}, 386 {'type': 'integer'},
387 {'type': 'string'} 387 {'type': 'string'}
388 ] 388 ]
389 }] 389 }]
390 }] 390 }]
391 391
392 self.assertEquals(expected, badabish_params) 392 self.assertEquals(expected, badabish_params)
393 393
394 def testProperties(self):
395 schema = idl_schema.Load('test/idl_properties.idl')[0]
396 self.assertEquals(OrderedDict([
397 ('first', OrderedDict([
398 ('description', 'Integer property.'),
399 ('type', 'integer'),
400 ('value', 42),
401 ])),
402 ('second', OrderedDict([
403 ('description', 'Double property.'),
404 ('type', 'number'),
405 ('value', 42.0),
406 ])),
407 ('third', OrderedDict([
408 ('description', 'String property.'),
409 ('type', 'string'),
410 ('value', 'hello world'),
411 ])),
412 ('fourth', OrderedDict([
413 ('description', 'Unvalued property.'),
414 ('type', 'integer'),
415 ])),
416 ]), schema.get('properties'))
417
394 418
395 if __name__ == '__main__': 419 if __name__ == '__main__':
396 unittest.main() 420 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/test/idl_properties.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698