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

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

Issue 10701012: JSON Schema Compiler: Added event compilation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Tested GetAllPossibleParameterLists better. Created 8 years, 5 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 from json_schema import CachedLoad 6 from json_schema import CachedLoad
7 import model 7 import model
8 import unittest 8 import unittest
9 9
10 class ModelTest(unittest.TestCase): 10 class ModelTest(unittest.TestCase):
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 def testDescription(self): 72 def testDescription(self):
73 self.assertFalse( 73 self.assertFalse(
74 self.permissions.functions['contains'].params[0].description) 74 self.permissions.functions['contains'].params[0].description)
75 self.assertEquals('True if the extension has the specified permissions.', 75 self.assertEquals('True if the extension has the specified permissions.',
76 self.permissions.functions['contains'].callback.params[0].description) 76 self.permissions.functions['contains'].callback.params[0].description)
77 77
78 def testPropertyUnixName(self): 78 def testPropertyUnixName(self):
79 param = self.tabs.functions['move'].params[0] 79 param = self.tabs.functions['move'].params[0]
80 self.assertEquals('tab_ids', param.unix_name) 80 self.assertEquals('tab_ids', param.unix_name)
81 self.assertRaises(AttributeError,
82 param.choices[model.PropertyType.INTEGER].GetUnixName)
83 param.choices[model.PropertyType.INTEGER].unix_name = 'asdf' 81 param.choices[model.PropertyType.INTEGER].unix_name = 'asdf'
84 param.choices[model.PropertyType.INTEGER].unix_name = 'tab_ids_integer' 82 param.choices[model.PropertyType.INTEGER].unix_name = 'tab_ids_integer'
85 self.assertEquals('tab_ids_integer', 83 self.assertEquals('tab_ids_integer',
86 param.choices[model.PropertyType.INTEGER].unix_name) 84 param.choices[model.PropertyType.INTEGER].unix_name)
87 self.assertRaises(AttributeError, 85 self.assertRaises(AttributeError,
88 param.choices[model.PropertyType.INTEGER].SetUnixName, 'breakage') 86 param.choices[model.PropertyType.INTEGER].SetUnixName, 'breakage')
89 87
90 def testUnixName(self): 88 def testUnixName(self):
91 expectations = { 89 expectations = {
92 'foo': 'foo', 90 'foo': 'foo',
93 'fooBar': 'foo_bar', 91 'fooBar': 'foo_bar',
94 'fooBarBaz': 'foo_bar_baz', 92 'fooBarBaz': 'foo_bar_baz',
95 'fooBARBaz': 'foo_bar_baz', 93 'fooBARBaz': 'foo_bar_baz',
96 'fooBAR': 'foo_bar', 94 'fooBAR': 'foo_bar',
97 'FOO': 'foo', 95 'FOO': 'foo',
98 'FOOBar': 'foo_bar', 96 'FOOBar': 'foo_bar',
99 'foo.bar': 'foo_bar', 97 'foo.bar': 'foo_bar',
100 'foo.BAR': 'foo_bar', 98 'foo.BAR': 'foo_bar',
101 'foo.barBAZ': 'foo_bar_baz' 99 'foo.barBAZ': 'foo_bar_baz'
102 } 100 }
103 for name in expectations: 101 for name in expectations:
104 self.assertEquals(expectations[name], model.UnixName(name)); 102 self.assertEquals(expectations[name], model.UnixName(name));
105 103
106 if __name__ == '__main__': 104 if __name__ == '__main__':
107 unittest.main() 105 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698