summaryrefslogtreecommitdiff
path: root/Lib/unittest/test
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2017-02-06 07:15:57 -0800
committerRaymond Hettinger <python@rcn.com>2017-02-06 07:15:57 -0800
commit826745ba953b4ef23462fb0bc2d7b3db23b51d89 (patch)
tree7789cc87df07c2786c40e6888cbb532a94ce6334 /Lib/unittest/test
parent95b272b4e0d5438a12702e51e05d03f5a5a8e505 (diff)
parent515f1cf20f4e9656b1bcda236bad8ed0e33770f0 (diff)
downloadcpython-826745ba953b4ef23462fb0bc2d7b3db23b51d89.tar.gz
merge
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r--Lib/unittest/test/testmock/testsentinel.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testsentinel.py b/Lib/unittest/test/testmock/testsentinel.py
index 3fb5acbc25..de53509803 100644
--- a/Lib/unittest/test/testmock/testsentinel.py
+++ b/Lib/unittest/test/testmock/testsentinel.py
@@ -1,4 +1,6 @@
import unittest
+import copy
+import pickle
from unittest.mock import sentinel, DEFAULT
@@ -23,6 +25,17 @@ class SentinelTest(unittest.TestCase):
# If this doesn't raise an AttributeError then help(mock) is broken
self.assertRaises(AttributeError, lambda: sentinel.__bases__)
+ def testPickle(self):
+ for proto in range(pickle.HIGHEST_PROTOCOL+1):
+ with self.subTest(protocol=proto):
+ pickled = pickle.dumps(sentinel.whatever, proto)
+ unpickled = pickle.loads(pickled)
+ self.assertIs(unpickled, sentinel.whatever)
+
+ def testCopy(self):
+ self.assertIs(copy.copy(sentinel.whatever), sentinel.whatever)
+ self.assertIs(copy.deepcopy(sentinel.whatever), sentinel.whatever)
+
if __name__ == '__main__':
unittest.main()