Michael Foord | 1e68bec | 2012-03-03 22:24:30 +0000 | [diff] [blame] | 1 | # Copyright (C) 2007-2012 Michael Foord & the mock team |
| 2 | # E-mail: fuzzyman AT voidspace DOT org DOT uk |
| 3 | # http://www.voidspace.org.uk/python/mock/ |
| 4 | |
| 5 | from tests.support import unittest2 |
| 6 | |
| 7 | from mock import sentinel, DEFAULT |
| 8 | |
| 9 | |
| 10 | class SentinelTest(unittest2.TestCase): |
| 11 | |
| 12 | def testSentinels(self): |
| 13 | self.assertEqual(sentinel.whatever, sentinel.whatever, |
| 14 | 'sentinel not stored') |
| 15 | self.assertNotEqual(sentinel.whatever, sentinel.whateverelse, |
| 16 | 'sentinel should be unique') |
| 17 | |
| 18 | |
| 19 | def testSentinelName(self): |
| 20 | self.assertEqual(str(sentinel.whatever), 'sentinel.whatever', |
| 21 | 'sentinel name incorrect') |
| 22 | |
| 23 | |
| 24 | def testDEFAULT(self): |
| 25 | self.assertTrue(DEFAULT is sentinel.DEFAULT) |
| 26 | |
| 27 | def testBases(self): |
| 28 | # If this doesn't raise an AttributeError then help(mock) is broken |
| 29 | self.assertRaises(AttributeError, lambda: sentinel.__bases__) |
| 30 | |
| 31 | |
| 32 | if __name__ == '__main__': |
| 33 | unittest2.main() |