Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'test,': 0.07; 'deprecated': 0.09; 'latter': 0.09; 'optparse': 0.09; 'parsing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'unittest': 0.09; 'whichever': 0.09; 'fashionable.': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'library': 0.18; 'unlike': 0.19; 'proposed': 0.22; 'header:User- Agent:1': 0.23; 'library,': 0.24; 'math': 0.24; 'paul': 0.24; 'header:X-Complaints-To:1': 0.27; 'testing': 0.29; "i'm": 0.30; 'writes:': 0.31; 'option': 0.32; 'quite': 0.32; 'url:python': 0.33; "can't": 0.35; 'but': 0.35; 'acceptable': 0.36; 'library.': 0.36; 'url:org': 0.36; 'should': 0.36; 'unit': 0.37; 'ben': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'url:3': 0.61; 'more': 0.64; 'different': 0.65; 'skip:\xe2 10': 0.65; 'capable': 0.67; 'normal.': 0.68; '8bit%:43': 0.74; '8bit%:46': 0.78; 'subject:this': 0.83; 'received:125': 0.84; 'subject:good': 0.84; '8bit%:33': 0.91; 'migrating': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Is this a good way to implement testing Date: Sun, 03 May 2015 14:49:30 +1000 References: <878ud6mx4y.fsf@Equus.decebal.nl> <87k2wq2tx8.fsf@jester.gateway.sonic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:j+w0SY6GuDN6r9CqRPzj9DXPMYM= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430628582 news.xs4all.nl 2891 [2001:888:2000:d::a6]:42543 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89828 Paul Rubin writes: > Cecil Westerhof 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 . 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