| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """ | 3 """ |
| 4 Copyright 2014 Google Inc. | 4 Copyright 2014 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 Test imagepair.py | 9 Test imagepair.py |
| 10 """ | 10 """ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 None, | 84 None, |
| 85 # expected output: | 85 # expected output: |
| 86 { | 86 { |
| 87 'differenceData': { | 87 'differenceData': { |
| 88 'maxDiffPerChannel': [255, 255, 247], | 88 'maxDiffPerChannel': [255, 255, 247], |
| 89 'numDifferingPixels': 662, | 89 'numDifferingPixels': 662, |
| 90 'percentDifferingPixels': 0.0662, | 90 'percentDifferingPixels': 0.0662, |
| 91 'perceptualDifference': 0.06620300000000157, | 91 'perceptualDifference': 0.06620300000000157, |
| 92 'diffUrl': 'arcofzorro_16206093933823793653_png_png-vs-' + | 92 'diffUrl': 'arcofzorro_16206093933823793653_png_png-vs-' + |
| 93 'arcofzorro_13786535001616823825_png_png.png', | 93 'arcofzorro_13786535001616823825_png_png.png', |
| 94 'whiteDiffUrl': 'arcofzorro_16206093933823793653_png_png' + | 94 'whiteDiffUrl': 'arcofzorro_16206093933823793653_png_png' + |
| 95 '-vs-arcofzorro_13786535001616823825_png_png.png', | 95 '-vs-arcofzorro_13786535001616823825_png_png.png', |
| 96 }, | 96 }, |
| 97 'imageAUrl': 'arcofzorro/16206093933823793653.png', | 97 'imageAUrl': 'arcofzorro/16206093933823793653.png', |
| 98 'imageBUrl': 'arcofzorro/13786535001616823825.png', | 98 'imageBUrl': 'arcofzorro/13786535001616823825.png', |
| 99 'isDifferent': True, | 99 'isDifferent': True, |
| 100 }, | 100 }, |
| 101 ], | 101 ], |
| 102 | 102 |
| 103 [ | 103 [ |
| 104 # inputs: | 104 # inputs: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 'isDifferent': True, | 188 'isDifferent': True, |
| 189 }, | 189 }, |
| 190 ], | 190 ], |
| 191 | 191 |
| 192 ] | 192 ] |
| 193 | 193 |
| 194 db = imagediffdb.ImageDiffDB(self.temp_dir) | 194 db = imagediffdb.ImageDiffDB(self.temp_dir) |
| 195 for selftest in selftests: | 195 for selftest in selftests: |
| 196 image_pair = imagepair.ImagePair( | 196 image_pair = imagepair.ImagePair( |
| 197 image_diff_db=db, | 197 image_diff_db=db, |
| 198 base_url=IMG_URL_BASE, | 198 imageA_base_url=IMG_URL_BASE, |
| 199 imageB_base_url=IMG_URL_BASE, |
| 199 imageA_relative_url=selftest[0], | 200 imageA_relative_url=selftest[0], |
| 200 imageB_relative_url=selftest[1], | 201 imageB_relative_url=selftest[1], |
| 201 expectations=selftest[2], | 202 expectations=selftest[2], |
| 202 extra_columns=selftest[3], | 203 extra_columns=selftest[3], |
| 203 download_all_images=True) | 204 download_all_images=True) |
| 204 self.assertEqual(image_pair.as_dict(), selftest[4]) | 205 self.assertEqual(image_pair.as_dict(), selftest[4]) |
| 205 | 206 |
| 206 | 207 |
| 207 def main(): | 208 def main(): |
| 208 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) | 209 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) |
| 209 unittest.TextTestRunner(verbosity=2).run(suite) | 210 unittest.TextTestRunner(verbosity=2).run(suite) |
| 210 | 211 |
| 211 | 212 |
| 212 if __name__ == '__main__': | 213 if __name__ == '__main__': |
| 213 main() | 214 main() |
| OLD | NEW |