bpo-44353: Improve tests covering typing.NewType pickling (GH-27302)

This commit is contained in:
Yurii Karabas 2021-07-24 12:53:40 +03:00 committed by GitHub
parent 8072a1181d
commit a22b05da87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -3755,6 +3755,7 @@ class NewTypeTests:
def test_pickle(self):
UserAge = self.module.NewType('UserAge', float)
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
with self.subTest(proto=proto):
pickled = pickle.dumps(UserId, proto)
loaded = pickle.loads(pickled)
self.assertIs(loaded, UserId)