Beispiel #1
0
 def read_async(self, *a, **v):
     for obj, result, exc, url in read_async(*a, **v):
         assert _ismainthread()
         self.progress += 1
         if exc:
             self.errors.append(exc)
         else:
             self.successes.append(result)
Beispiel #2
0
 def read_async_raise_exc_in_called_func(self, *a, **v):
     """it is easy to check what happens if an unknown exception is raised from urllib: just mock it
     but what about an exception raised in the caller body, if urlread is ok? Check it here
     """
     for obj, result, exc, url in read_async(*a, **v):
         assert _ismainthread()
         raise KeyboardInterrupt()
         self.progress += 1
         if exc:
             self.errors.append(exc)
         else:
             self.successes.append(result)
 def _onerror(self, error, url, index):
     assert _ismainthread()
     self.errors.append(error)
     return self.onerror_return_value
 def _onsuccess(self, data, url, index):
     assert _ismainthread()
     self.successes.append(data)
     return self.onsuccess_return_value