本文整理汇总了Python中smanstal.tests.mksuite函数的典型用法代码示例。如果您正苦于以下问题:Python mksuite函数的具体用法?Python mksuite怎么用?Python mksuite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mksuite函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
def tearDown(self): # {{{
pass
# End def #}}}
def testSetZero(self): # {{{
"""Setting to zero deletes"""
a = multiset((10, 20, 30))
a[10] = 0
expected = set({20: 1, 30: 1}.items())
self.assertEqual(set(a.items()), expected)
# End def #}}}
def testBadNegative(self): # {{{
"""Cannot set negative values"""
a = multiset([20])
msg = re.compile("Negative element counts are invalid: -100")
self.assertRaisesEx(ValueError, a.__setitem__, 20, -100, exc_pattern=msg)
# End def #}}}
# End class #}}}
# Create suite function for this module
suite = addtest(mksuite(__file__))
if __name__ == "__main__":
unittest.TextTestRunner(verbosity=2).run(suite())
示例2: __import__
continue
sysmod['/%s/_private/%s' %(basepackage, '/'.join(p))] = __import__(name)
sysmod.pop(name, None)
sys.path = oldpath
# End def #}}}
# Create suite function for this package
#suite = addtest(__file__)(mksuite(__file__))
def init(): #{{{
basedir = abspath(__file__)
basedir = join(sep, *dirname(basedir).split(sep)[1:-1])
global basepackage
if not basepackage:
basepackage = basename(basedir)
set_private_packages(basedir)
# End def #}}}
if __name__ == '__main__':
# Set up environment
init()
alltests = __import__('/%s/_private/tests/alltests' %basepackage)
python = __import__('/%s/_private/util/python' %basepackage)
app_version = __import__('/%s/_private/util/python.version' %basepackage)
alltests = alltests.__file__
suite = addtest(alltests)(mksuite(alltests))
# Run the tests
unittest.TextTestRunner(verbosity=2).run(suite())