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

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

Issue 11079010: Extensions Docs Server: Preserve JSON declaration order in extensions documentation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more efficient ordered_dict Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(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 def _ReadTestFile(filename):
11 with open(os.path.join('test', filename)) as f:
12 return f.read()
13
14 class JSONParseTest(unittest.TestCase):
15 def testParse(self):
16 json_str = _ReadTestFile('tabs.json')
17 json0 = json.loads(json_str)
18
19 import json_parse as jp1
20 json1 = jp1.Parse(json_str)
21
22 # Force use of simplejson, even in Python 2.7.
23 json.loads = None
24 import json_parse as jp2
25 json2 = jp2.Parse(json_str)
26
27 self.assertEqual(json0, json1)
28 self.assertEqual(json0, json2)
29 self.assertEqual(json1, json2)
30
31 if __name__ == '__main__':
32 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698