diff options
author | Martin v. L?wis <martin@v.loewis.de> | 2012-06-03 12:00:48 +0200 |
---|---|---|
committer | Martin v. L?wis <martin@v.loewis.de> | 2012-06-03 12:00:48 +0200 |
commit | 183bc7b78cb50c73b3142710b3b8fbafde4a3833 (patch) | |
tree | 8a29bbfd852dccb5f14340c8d1c6309cf8fdfb72 /Lib/unittest/test/testmock/testsentinel.py | |
parent | 15670dc71126aabce6daca6c8d32f55ea146cc11 (diff) | |
parent | 9fe4e3d311149c5f07073f7c55509fcfd7dde47e (diff) | |
download | cpython-183bc7b78cb50c73b3142710b3b8fbafde4a3833.tar.gz |
Merge 3.2: issue #14937.
Diffstat (limited to 'Lib/unittest/test/testmock/testsentinel.py')
-rw-r--r-- | Lib/unittest/test/testmock/testsentinel.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testsentinel.py b/Lib/unittest/test/testmock/testsentinel.py new file mode 100644 index 0000000000..bfda68ece3 --- /dev/null +++ b/Lib/unittest/test/testmock/testsentinel.py @@ -0,0 +1,28 @@ +import unittest +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.assertTrue(DEFAULT is sentinel.DEFAULT) + + def testBases(self): + # If this doesn't raise an AttributeError then help(mock) is broken + self.assertRaises(AttributeError, lambda: sentinel.__bases__) + + +if __name__ == '__main__': + unittest.main() |