Is this a good way to implement testing
Ben Finney
ben+python at benfinney.id.au
Sun May 3 00:49:30 EDT 2015
Paul Rubin <no.email at nospam.invalid> writes:
> Cecil Westerhof <Cecil at decebal.nl> writes:
>
> > action = options[0][0]
> > if action == '--all': ...
>
> Yecch, use an option parsing library for that, whichever one is
> currently fashionable. I think optparse is deprecated now but I still
> use it because I'm used to it.
Yes, ‘optparse’ has been superseded by the more capable ‘argparse’
library <URL:https://docs.python.org/3/library/argparse.html>.
Migrating from ‘optparse’ to ‘argparse’ is quite straightforward, since
the latter was designed to be very similar.
> > Is this an acceptable way of working?
>
> You should also use the currently fashionable unit testing library. I
> use unittest because yada yada but I think it's now considered old
> school.
I disagree, using ‘unittest’ is still quite normal. It's also in the
standard library, unlike proposed replacements.
--
\ “Instead of having ‘answers’ on a math test, they should just |
`\ call them ‘impressions’, and if you got a different |
_o__) ‘impression’, so what, can't we all be brothers?” —Jack Handey |
Ben Finney
More information about the Python-list
mailing list