J
john_sips_tea
For writing testcode, it looks like there's three ways that it's
typically done:
(1). using the doctest module,
(2). using the unittest module (i.e. "pyunit"), or else
(3). just putting an "if __name__ = '__main__':" at the bottom of your
module containing code to manually run your class through its paces.
So, which way is preferred? Seems to me that unittest is the way to go,
at least because it has you separate your test code from the code being
tested.
If unittest is the standard way to write test code, why do we still
have doctest? (I notice there's no mention in PEP 3000 of deprecating
the doctest module).
typically done:
(1). using the doctest module,
(2). using the unittest module (i.e. "pyunit"), or else
(3). just putting an "if __name__ = '__main__':" at the bottom of your
module containing code to manually run your class through its paces.
So, which way is preferred? Seems to me that unittest is the way to go,
at least because it has you separate your test code from the code being
tested.
If unittest is the standard way to write test code, why do we still
have doctest? (I notice there's no mention in PEP 3000 of deprecating
the doctest module).