Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'output': 0.04; 'test,': 0.05; 'that?': 0.05; 'calls.': 0.07; 'rewrite': 0.07; 'subject:test': 0.07; '0),': 0.09; '[0,': 0.09; 'called.': 0.09; 'friday,': 0.09; 'sep': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; '(ie,': 0.16; '-1))': 0.16; '1),': 0.16; '10:59': 0.16; 'directly?': 0.16; 'eval': 0.16; 'interpreting': 0.16; 'iterator': 0.16; 'keyerror': 0.16; 'script?': 0.16; 'subject:strategy': 0.16; 'wrote:': 0.17; 'script.': 0.17; 'creates': 0.18; 'tests': 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; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'accuracy': 0.27; 'replace': 0.27; 'thoughts': 0.27; 'developing': 0.28; 'rest': 0.28; 'actual': 0.28; 'run': 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; 'there': 0.35; 'created': 0.36; 'but': 0.36; 'programmers': 0.36; 'useful': 0.36; 'test': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'hello,': 0.39; 'think': 0.40; 'your': 0.60; 'easy': 0.60; 'first': 0.61; 'between': 0.63; 'effective': 0.63; 'more': 0.63; 'show': 0.63; 'within': 0.64; 'strategy': 0.64; 'differences': 0.65; 'difficulty': 0.65; 'risk': 0.66; 'direct': 0.69; 'below:': 0.71; 'presented': 0.72; 'introduce': 0.80; 'are?': 0.84; 'david,': 0.84; 'differences,': 0.84 Newsgroups: comp.lang.python Date: Sat, 15 Sep 2012 20:24:52 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=67.184.78.189; posting-account=MQ3pigoAAACeFzUFjVAePnOjOJMNlvq9 References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 67.184.78.189 MIME-Version: 1.0 Subject: Re: unit test strategy From: Aaron Brady To: comp.lang.python@googlegroups.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 124 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347766616 news.xs4all.nl 6841 [2001:888:2000:d::a6]:42159 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29279 On Friday, September 14, 2012 10:32:47 PM UTC-5, David Hutto wrote: > On Fri, Sep 14, 2012 at 11:26 PM, Dwight Hutto w= rote: >=20 > > On Fri, Sep 14, 2012 at 10:59 PM, Aaron Brady wr= ote: >=20 > >> Hello, >=20 > >> >=20 > >> I've developing a test script. There's a lot of repetition. I want t= o 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 wha= t people's reactions to and thoughts about it are. >=20 > >> >=20 > >> The first strategy I used created an iterator and advanced it between = each step: >=20 > > >=20 > > That isn't a refined iterator below: >=20 > What I mean is look at the similarities, and the differences, then >=20 > replace the differences with interpolation, in eval even. >=20 >=20 >=20 >=20 >=20 > > >=20 > >> self.op_chain(range(5), ('add', 5)) >=20 > >> self.op_chain(range(5), ('add', -2), ('add', -1)) >=20 > >> self.op_chain(range(5), ('discard', -1), ('add', 5)) >=20 > >> self.op_chain_ok(range(5), ('update', [0, 1])) >=20 > >> Etc. >=20 > >> >=20 > >> I'm considering something more complicated. 'iN' creates iterator N, = 'nN' advances iterator N, an exception calls 'assertRaises', and the rest a= re function calls. >=20 >=20 >=20 > iN =3D [N for N in range(0,5)] >=20 >=20 >=20 >=20 >=20 > >> dsi=3D dict.__setitem__ >=20 > >> ddi=3D dict.__delitem__ >=20 > >> dsd=3D dict.setdefault >=20 > >> KE=3D KeyError >=20 > >> IE=3D IterationError >=20 > >> self.chain(range(10), 'i0', (dsi, 0, 1), 'n0', (dsi, 10, 1), (= IE, 'n0')) >=20 > >> self.chain(range(10), 'i0', 'n0', (dsd, 0, 0), 'n0', (dsd, 10,= 1), (IE, 'n0')) >=20 > >> self.chain(range(10), 'i0', (KE, ddi, 10), 'n0', (ddi, 9), (IE= , 'n0')) >=20 > >> >=20 > >> Do you think the 2nd version is legible? Could it interfere with the = accuracy of the test? >=20 >=20 >=20 > Define the 2nd version >=20 >=20 >=20 >=20 >=20 > > >=20 > > Show the test, which should show instances of what you want called. >=20 > > >=20 > > I could rewrite the above, but it seems you're more in need of refining >=20 > > your iterations, and the values given within them. >=20 > > >=20 >=20 >=20 > --=20 >=20 > Best Regards, >=20 > David Hutto >=20 > CEO: http://www.hitwebdevelopment.com Hi David, I'm interested in your comments, but I had difficulty interpreting them. W= hat I want to know is, do people think that the 2nd version I presented wou= ld be a more effective test script? Do you think it would be more useful to run the tests in the function call = directly? Or would it be more useful to output a program script and then r= un that? Is there some risk that the direct test would interfere with the = results? And, is the 2nd version legible? That is, is it easy for other p= rogrammers to tell what the purpose and actual effects of a given test are?