/opt/imh-python/lib/python3.9/unittest/test/testmock
NameSizeModeActions
__pycache__/-0755rm
support.py2680644editdlrm
testasync.py372060644editdlrm
testcallable.py42670644editdlrm
testhelpers.py336480644editdlrm
testmagicmethods.py162430644editdlrm
testmock.py718370644editdlrm
testpatch.py589660644editdlrm
testsealable.py49950644editdlrm
testsentinel.py13250644editdlrm
testwith.py122590644editdlrm
__init__.py4650644editdlrm
__main__.py6230644editdlrm
Edit: /opt/imh-python/lib/python3.9/unittest/test/testmock/testsentinel.py (1325B)
import unittest import copy import pickle from unittest.mock import sentinel, DEFAULT class SentinelTest(unittest.TestCase): def testSentinels(self): self.assertEqual(sentinel.whatever, sentinel.whatever, 'sentinel not stored') self.assertNotEqual(sentinel.whatever, sentinel.whateverelse, 'sentinel should be unique') def testSentinelName(self): self.assertEqual(str(sentinel.whatever), 'sentinel.whatever', 'sentinel name incorrect') def testDEFAULT(self): self.assertIs(DEFAULT, sentinel.DEFAULT) def testBases(self): # 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()