Unit-testing single function with large number of different inputs

Peter Otten __peter__ at web.de
Wed Feb 18 09:51:22 EST 2004


Edvard Majakari wrote:

> now, running tests with the -v flag I don't see the neat docstrings I've
> used everywhere, but class instance strings (which is not that neat).
> Then again, it doesn't really matter, but still..

Just override the __str__() method to your needs, e. g:

class Base(unittest.TestCase):
    def __init__(self, filename):
        unittest.TestCase.__init__(self)
        self.filename = filename
    def __str__(self):
        return self.filename

Peter



More information about the Python-list mailing list