| OLD | NEW |
| 1 import unittest | 1 import unittest |
| 2 import pickle | 2 import pickle |
| 3 | 3 |
| 4 from common import MTurkCommon | 4 from common import MTurkCommon |
| 5 | 5 |
| 6 class TestHITPersistence(MTurkCommon): | 6 class TestHITPersistence(MTurkCommon): |
| 7 def create_hit_result(self): | 7 def create_hit_result(self): |
| 8 return self.conn.create_hit( | 8 return self.conn.create_hit( |
| 9 question=self.get_question(), **self.get_hit_params() | 9 question=self.get_question(), **self.get_hit_params() |
| 10 ) | 10 ) |
| 11 | 11 |
| 12 def test_pickle_hit_result(self): | 12 def test_pickle_hit_result(self): |
| 13 result = self.create_hit_result() | 13 result = self.create_hit_result() |
| 14 new_result = pickle.loads(pickle.dumps(result)) | 14 new_result = pickle.loads(pickle.dumps(result)) |
| 15 | 15 |
| 16 def test_pickle_deserialized_version(self): | 16 def test_pickle_deserialized_version(self): |
| 17 """ | 17 """ |
| 18 It seems the technique used to store and reload the object must | 18 It seems the technique used to store and reload the object must |
| 19 result in an equivalent object, or subsequent pickles may fail. | 19 result in an equivalent object, or subsequent pickles may fail. |
| 20 This tests a double-pickle to elicit that error. | 20 This tests a double-pickle to elicit that error. |
| 21 """ | 21 """ |
| 22 result = self.create_hit_result() | 22 result = self.create_hit_result() |
| 23 new_result = pickle.loads(pickle.dumps(result)) | 23 new_result = pickle.loads(pickle.dumps(result)) |
| 24 pickle.dumps(new_result) | 24 pickle.dumps(new_result) |
| 25 | 25 |
| 26 if __name__ == '__main__': | 26 if __name__ == '__main__': |
| 27 unittest.main() | 27 unittest.main() |
| OLD | NEW |