python/mock-1.0.0/tests/testsentinel.py

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial