Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 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. | |
| 5 | |
| 6 import json | |
| 7 import os | |
| 8 import unittest | |
| 9 | |
| 10 from dict_generator import DictGenerator | |
| 11 import third_party.json_schema_compiler.json_comment_eater as comment_eater | |
| 12 import third_party.json_schema_compiler.model as model | |
| 13 | |
| 14 class DictGeneratorTest(unittest.TestCase): | |
| 15 def setUp(self): | |
| 16 self._base_path = os.path.join('test_data', 'dict_generator') | |
| 17 | |
| 18 def _ReadLocalFile(self, filename): | |
| 19 with open(os.path.join(self._base_path, filename), 'r') as f: | |
| 20 return f.read() | |
| 21 | |
| 22 def _GenerateTest(self, filename): | |
| 23 expected_json = json.loads(self._ReadLocalFile('expected_' + filename)) | |
| 24 gen = DictGenerator( | |
| 25 json.loads(comment_eater.Nom(self._ReadLocalFile(filename)))[0]) | |
| 26 self.assertEquals(expected_json, gen.Generate()) | |
| 27 | |
| 28 | |
|
not at google - send to devlin
2012/06/19 20:33:10
extra \n ?
cduvall
2012/06/19 22:21:02
Done.
| |
| 29 def testGenerate(self): | |
| 30 self._GenerateTest('bookmarks.json') | |
| 31 self._GenerateTest('browser_action.json') | |
| 32 | |
| 33 if __name__ == '__main__': | |
| 34 unittest.main() | |
| OLD | NEW |