blob: 981171a450fbefa62d2d633cfbcb47f52067eb76 [file] [log] [blame]
Michael Foord1e68bec2012-03-03 22:24:30 +00001# 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
5from tests.support import unittest2
6
7from mock import sentinel, DEFAULT
8
9
10class 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
32if __name__ == '__main__':
33 unittest2.main()