GeezerVison is showing github.com — fix: pickling test case handle python 2 · sendgrid/python-http-client@57eed5e
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: tests/test_unit.py +16-4Lines changed: 16 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -222,10 +222,22 @@ def test_pickle_error(self, mock_lib): |
222 | 222 | except UnauthorizedError as e: |
223 | 223 | pickled_error = pickle.dumps(e) |
224 | 224 | unpickled_error = pickle.loads(pickled_error) |
225 | | - self.assertDictEqual( |
226 | | - e.__dict__, |
227 | | - unpickled_error.__dict__, |
228 | | - "original error and unpickled error must have the same state" |
| 225 | + |
| 226 | + self.assertEqual(e.status_code, |
| 227 | + unpickled_error.status_code, |
| 228 | + "unpickled error must have the same status code", |
| 229 | + ) |
| 230 | + self.assertEqual(e.reason, |
| 231 | + unpickled_error.reason, |
| 232 | + "unpickled error must have the same reason", |
| 233 | + ) |
| 234 | + self.assertEqual(e.body, |
| 235 | + unpickled_error.body, |
| 236 | + "unpickled error must have the same body", |
| 237 | + ) |
| 238 | + self.assertEqual(e.headers, |
| 239 | + unpickled_error.headers, |
| 240 | + "unpickled error must have the same headers", |
229 | 241 | ) |
230 | 242 |
|
231 | 243 |
|
|