OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 ''' | 3 ''' |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 ''' | 8 ''' |
9 | 9 |
10 ''' | 10 ''' |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 """ | 152 """ |
153 old_results = self._GetExpectedResults(oldfile) | 153 old_results = self._GetExpectedResults(oldfile) |
154 if newfile: | 154 if newfile: |
155 new_results = self._GetExpectedResults(newfile) | 155 new_results = self._GetExpectedResults(newfile) |
156 else: | 156 else: |
157 new_results = self._GetActualResults(oldfile) | 157 new_results = self._GetActualResults(oldfile) |
158 return self._DictionaryDiff(old_results, new_results) | 158 return self._DictionaryDiff(old_results, new_results) |
159 | 159 |
160 | 160 |
161 # main... | 161 # main... |
162 parser = argparse.ArgumentParser() | 162 if __name__ == '__main__': |
borenet
2013/07/12 19:48:04
I'd prefer having most of this stuff inside of a M
epoger
2013/07/16 17:29:55
Done.
| |
163 parser.add_argument('old', | 163 parser = argparse.ArgumentParser() |
164 help='Path to JSON file whose expectations to display on ' + | 164 parser.add_argument( |
165 'the "old" side of the diff. This can be a filepath on ' + | 165 'old', |
166 'local storage, or a URL.') | 166 help='Path to JSON file whose expectations to display on ' + |
167 parser.add_argument('new', nargs='?', | 167 'the "old" side of the diff. This can be a filepath on ' + |
168 help='Path to JSON file whose expectations to display on ' + | 168 'local storage, or a URL.') |
169 'the "new" side of the diff; if not specified, uses the ' + | 169 parser.add_argument( |
170 'ACTUAL results from the "old" JSON file. This can be a ' + | 170 'new', nargs='?', |
171 'filepath on local storage, or a URL.') | 171 help='Path to JSON file whose expectations to display on ' + |
172 args = parser.parse_args() | 172 'the "new" side of the diff; if not specified, uses the ' + |
173 differ = GMDiffer() | 173 'ACTUAL results from the "old" JSON file. This can be a ' + |
174 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) | 174 'filepath on local storage, or a URL.') |
175 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) | 175 args = parser.parse_args() |
176 differ = GMDiffer() | |
177 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) | |
178 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) | |
OLD | NEW |