Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29201

Re: unit test strategy

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'test,': 0.05; 'calls.': 0.07; 'rewrite': 0.07; 'subject:test': 0.07; '0),': 0.09; '[0,': 0.09; 'called.': 0.09; 'received:mail- vb0-f46.google.com': 0.09; 'sep': 0.09; 'cc:addr:python-list': 0.10; '(ie,': 0.16; '-1))': 0.16; '1),': 0.16; '10:59': 0.16; 'eval': 0.16; 'iterator': 0.16; 'keyerror': 0.16; 'subject:strategy': 0.16; 'wrote:': 0.17; 'script.': 0.17; 'creates': 0.18; 'received:209.85.212.46': 0.18; 'define': 0.20; 'are.': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'values': 0.26; 'accuracy': 0.27; 'replace': 0.27; 'thoughts': 0.27; 'message-id:@mail.gmail.com': 0.27; 'developing': 0.28; 'rest': 0.28; 'received:209.85.212': 0.28; "people's": 0.29; "i'm": 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'function': 0.30; 'could': 0.32; 'instances': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'created': 0.36; 'but': 0.36; 'test': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'hello,': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'first': 0.61; 'between': 0.63; 'more': 0.63; 'show': 0.63; 'within': 0.64; 'strategy': 0.64; 'differences': 0.65; 'below:': 0.71; 'introduce': 0.80; 'differences,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=06hBOsV7v+/r6Ca3CQxEPY7otu80Sb60gXkVb2FiD8o=; b=YT53w4+Ksu7N/Y24pVJFndZL4LtS2xMfkVotxQElFUmxGVkAuKhXn2fE89ZhlG5wA5 QFZjkkgAAHMdQ36GjJhHGOiLlu68EbDzbzzGozYEMcmctZlAronkGgypuKPt3yUFO8NU npGYoTh3lJudM3KasUNU7SMs7Kv5jvgrILWoA+JjoJceRg/cfpUbSlZQdpGbCoNvtPmX UDDas4KdhbFo4qzsAEIpGD9eVGi0cfmn+xzduv8DsAZuQTq6WAegNbWWFDyJD5vyy5Ul HPRII5pTy+Qvu12NtrTSuNWUMFPNIVNX2COVcJWBxn3ZIRWtirr7nYpAREAn2NCPYj4B OCJw==
MIME-Version 1.0
In-Reply-To <CA+vVgJXBJJaMA-cocmTtHQbAr8WiF=_QoFmCnpXQ1C6GuFgiFA@mail.gmail.com>
References <e0d36274-3345-4eeb-bc0a-9da283b9778f@googlegroups.com> <CA+vVgJXBJJaMA-cocmTtHQbAr8WiF=_QoFmCnpXQ1C6GuFgiFA@mail.gmail.com>
Date Fri, 14 Sep 2012 23:32:44 -0400
Subject Re: unit test strategy
From Dwight Hutto <dwightdhutto@gmail.com>
To Aaron Brady <castironpi@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.730.1347679967.27098.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347679967 news.xs4all.nl 6842 [2001:888:2000:d::a6]:39137
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29201

Show key headers only | View raw


On Fri, Sep 14, 2012 at 11:26 PM, Dwight Hutto <dwightdhutto@gmail.com> wrote:
> On Fri, Sep 14, 2012 at 10:59 PM, Aaron Brady <castironpi@gmail.com> wrote:
>> Hello,
>>
>> I've developing a test script.  There's a lot of repetition.  I want to introduce a strategy for approaching it, but I don't want the program to be discredited because of the test script.  Therefore, I'd like to know what people's reactions to and thoughts about it are.
>>
>> The first strategy I used created an iterator and advanced it between each step:
>
> That isn't a refined iterator below:
What I mean is look at the similarities, and the differences, then
replace the differences with interpolation, in eval even.


>
>>         self.op_chain(range(5), ('add', 5))
>>         self.op_chain(range(5), ('add', -2), ('add', -1))
>>         self.op_chain(range(5), ('discard', -1), ('add', 5))
>>         self.op_chain_ok(range(5), ('update', [0, 1]))
>> Etc.
>>
>> I'm considering something more complicated.  'iN' creates iterator N, 'nN' advances iterator N, an exception calls 'assertRaises', and the rest are function calls.

iN = [N for N in range(0,5)]


>>         dsi= dict.__setitem__
>>         ddi= dict.__delitem__
>>         dsd= dict.setdefault
>>         KE= KeyError
>>         IE= IterationError
>>         self.chain(range(10), 'i0', (dsi, 0, 1), 'n0', (dsi, 10, 1), (IE, 'n0'))
>>         self.chain(range(10), 'i0', 'n0', (dsd, 0, 0), 'n0', (dsd, 10, 1), (IE, 'n0'))
>>         self.chain(range(10), 'i0', (KE, ddi, 10), 'n0', (ddi, 9), (IE, 'n0'))
>>
>> Do you think the 2nd version is legible?  Could it interfere with the accuracy of the test?

Define the 2nd version


>
> Show the test, which should show instances of what you want called.
>
> I could rewrite the above, but it seems you're more in need of refining
> your iterations, and the values given within them.
>

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-14 19:59 -0700
  Re: unit test strategy Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-14 23:26 -0400
  Re: unit test strategy Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-14 23:32 -0400
    Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-15 20:24 -0700
    Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-15 20:24 -0700
  Re: unit test strategy Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 07:42 +0000
    Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-16 11:38 -0700
      Re: unit test strategy Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 20:01 +0000
        Re: unit test strategy Aaron Brady <castironpi@gmail.com> - 2012-09-22 20:07 -0700
  Re: unit test strategy Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-16 13:28 +0100

csiph-web