diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-03-14 19:24:34 (GMT) |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-03-14 19:24:34 (GMT) |
commit | 345266aa7e7fdbb1bbf3ffd244caff39406d46d2 (patch) | |
tree | 4b770dfa5808bea3c150fcb6e8801d2d4d9d6ba8 /Lib/unittest/test/testmock/testsentinel.py | |
parent | 8d8f11049265f4e53b2d97f5caa73c4ca0ee7875 (diff) | |
download | cpython-345266aa7e7fdbb1bbf3ffd244caff39406d46d2.zip cpython-345266aa7e7fdbb1bbf3ffd244caff39406d46d2.tar.gz cpython-345266aa7e7fdbb1bbf3ffd244caff39406d46d2.tar.bz2 |
PEP 417: Adding unittest.mock
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 0000000..bfda68e --- /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() |