OLD | NEW |
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 json | 6 import json |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 import unittest | 9 import unittest |
10 | 10 |
11 from file_system import FileNotFoundError | 11 from file_system import FileNotFoundError |
12 from in_memory_object_store import InMemoryObjectStore | |
13 from reference_resolver import ReferenceResolver | 12 from reference_resolver import ReferenceResolver |
14 from test_object_store import TestObjectStore | 13 from test_object_store import TestObjectStore |
15 | 14 |
16 class FakeAPIDataSource(object): | 15 class FakeAPIDataSource(object): |
17 def __init__(self, json_data): | 16 def __init__(self, json_data): |
18 self._json = json_data | 17 self._json = json_data |
19 | 18 |
20 def get(self, key): | 19 def get(self, key): |
21 if key not in self._json: | 20 if key not in self._json: |
22 raise FileNotFoundError(key) | 21 raise FileNotFoundError(key) |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 namespace='baz')) | 158 namespace='baz')) |
160 | 159 |
161 # Allow bare "$ref:foo.bar." at the end of a string. | 160 # Allow bare "$ref:foo.bar." at the end of a string. |
162 self.assertEqual( | 161 self.assertEqual( |
163 '<a href="bar.html#type-bon">bar.bon</a>.', | 162 '<a href="bar.html#type-bon">bar.bon</a>.', |
164 resolver.ResolveAllLinks('$ref:bar.bon.', | 163 resolver.ResolveAllLinks('$ref:bar.bon.', |
165 namespace='baz')) | 164 namespace='baz')) |
166 | 165 |
167 if __name__ == '__main__': | 166 if __name__ == '__main__': |
168 unittest.main() | 167 unittest.main() |
OLD | NEW |