| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 }, | 154 }, |
| 155 'extraColumns': { | 155 'extraColumns': { |
| 156 'builder': 'MyBuilder', | 156 'builder': 'MyBuilder', |
| 157 'test': 'MyTest', | 157 'test': 'MyTest', |
| 158 }, | 158 }, |
| 159 'imageAUrl': 'arcofzorro/16206093933823793653.png', | 159 'imageAUrl': 'arcofzorro/16206093933823793653.png', |
| 160 'imageBUrl': 'nonexistentDir/111111.png', | 160 'imageBUrl': 'nonexistentDir/111111.png', |
| 161 'isDifferent': True, | 161 'isDifferent': True, |
| 162 }, | 162 }, |
| 163 ], | 163 ], |
| 164 |
| 165 # One of the two images is missing, but download_all_images=True so we |
| 166 # should download it anyway. |
| 167 [ |
| 168 # inputs: |
| 169 None, |
| 170 'arcofzorro/13786535001616823825.png', |
| 171 None, |
| 172 None, |
| 173 # expected output: |
| 174 { |
| 175 'imageAUrl': None, |
| 176 'imageBUrl': 'arcofzorro/13786535001616823825.png', |
| 177 'isDifferent': True, |
| 178 }, |
| 179 ], |
| 180 |
| 164 ] | 181 ] |
| 165 | 182 |
| 166 db = imagediffdb.ImageDiffDB(self.temp_dir) | 183 db = imagediffdb.ImageDiffDB(self.temp_dir) |
| 167 for selftest in selftests: | 184 for selftest in selftests: |
| 168 image_pair = imagepair.ImagePair( | 185 image_pair = imagepair.ImagePair( |
| 169 image_diff_db=db, | 186 image_diff_db=db, |
| 170 base_url=IMG_URL_BASE, | 187 base_url=IMG_URL_BASE, |
| 171 imageA_relative_url=selftest[0], | 188 imageA_relative_url=selftest[0], |
| 172 imageB_relative_url=selftest[1], | 189 imageB_relative_url=selftest[1], |
| 173 expectations=selftest[2], | 190 expectations=selftest[2], |
| 174 extra_columns=selftest[3]) | 191 extra_columns=selftest[3], |
| 192 download_all_images=True) |
| 175 self.assertEqual(image_pair.as_dict(), selftest[4]) | 193 self.assertEqual(image_pair.as_dict(), selftest[4]) |
| 176 | 194 |
| 177 | 195 |
| 178 def main(): | 196 def main(): |
| 179 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) | 197 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) |
| 180 unittest.TextTestRunner(verbosity=2).run(suite) | 198 unittest.TextTestRunner(verbosity=2).run(suite) |
| 181 | 199 |
| 182 | 200 |
| 183 if __name__ == '__main__': | 201 if __name__ == '__main__': |
| 184 main() | 202 main() |
| OLD | NEW |