python/mock-1.0.0/tests/testsentinel.py

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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/
     5 from tests.support import unittest2
     7 from mock import sentinel, DEFAULT
    10 class SentinelTest(unittest2.TestCase):
    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')
    19     def testSentinelName(self):
    20         self.assertEqual(str(sentinel.whatever), 'sentinel.whatever',
    21                          'sentinel name incorrect')
    24     def testDEFAULT(self):
    25         self.assertTrue(DEFAULT is sentinel.DEFAULT)
    27     def testBases(self):
    28         # If this doesn't raise an AttributeError then help(mock) is broken
    29         self.assertRaises(AttributeError, lambda: sentinel.__bases__)
    32 if __name__ == '__main__':
    33     unittest2.main()

mercurial