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())
Ejemplo n.º 2
0
# Module: template
# File: template.py
# Copyright (C) 2006 Ariel De Ocampo [email protected]
#
# This module is part of the <WHAT-HAVE-YOU> project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

import unittest
from smanstal.tests import addtest, mkdocsuite

# All tests go here
from os.path import abspath, sep, join as joinpath
apidocdir = joinpath(sep.join(abspath(__file__).split(sep)[:-3]), 'docs', 'manual')

# Create suite function for this module
suite = addtest(mkdocsuite(apidocdir, recurse=True))

if __name__ == '__main__':
    unittest.TextTestRunner(verbosity=2).run(suite())

Ejemplo n.º 3
0
# Module: template
# File: template.py
# Copyright (C) 2006 Ariel De Ocampo [email protected]
#
# This module is part of the <WHAT-HAVE-YOU> project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

import unittest
from smanstal.tests import addtest, mkdocsuite

# All tests go here
from os.path import abspath, sep, join as joinpath
testdir = joinpath(sep.join(abspath(__file__).split(sep)[:-3]), 'tests', 'doc')

# Create suite function for this module
suite = addtest(mkdocsuite(testdir, recurse=True))

if __name__ == '__main__':
    unittest.TextTestRunner(verbosity=2).run(suite())

Ejemplo n.º 4
0
            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())
Ejemplo n.º 5
0
# Module: template
# File: template.py
# Copyright (C) 2006 Ariel De Ocampo [email protected]
#
# This module is part of the <WHAT-HAVE-YOU> project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

import unittest
from smanstal.tests import addtest, mkdocsuite

# All tests go here
from os.path import abspath, sep, join as joinpath
manualdocdir = joinpath(sep.join(abspath(__file__).split(sep)[:-3]), 'doc', 'manual')

# Create suite function for this module
suite = addtest(mkdocsuite(manualdocdir, recurse=True))

if __name__ == '__main__':
    unittest.TextTestRunner(verbosity=2).run(suite())