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


Groups > comp.lang.python > #18730

Re: replacing __dict__ with an OrderedDict

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.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 <python-python-list@m.gmane.org>
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; 'bug': 0.02; 'debug': 0.03; 'test,': 0.04; 'suppose': 0.05; 'sure.': 0.05; 'received:verizon.net': 0.07; 'terry': 0.07; 'python': 0.08; 'assert': 0.09; 'dependency': 0.09; 'flush': 0.09; 'inclined': 0.09; 'rebuild': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'api': 0.09; 'meaningful': 0.13; 'agree.': 0.16; 'differently,': 0.16; 'eckhardt': 0.16; 'failed.': 0.16; 'randomize': 0.16; 'randomizes': 0.16; 'reedy': 0.16; 'roy': 0.16; 'scenarios': 0.16; 'sequential': 0.16; 'stop.': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'part,': 0.18; 'jan': 0.19; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'string': 0.24; 'obviously': 0.25; 'tests': 0.25; "i'm": 0.26; 'random': 0.28; 'forgot': 0.29; 'worked': 0.29; 'problem': 0.29; 'print': 0.29; 'pm,': 0.29; 'class': 0.29; 'example': 0.29; 'server': 0.30; 'means,': 0.30; 'ran': 0.30; 'separately.': 0.30; "i've": 0.31; "didn't": 0.31; 'cases': 0.32; 'words,': 0.32; "can't": 0.32; 'header:User- Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'done': 0.34; 'to:addr:python-list': 0.34; 'it.': 0.34; 'creates': 0.34; 'framework': 0.34; 'realize': 0.34; 'things': 0.34; 'anything': 0.34; 'advocate': 0.34; 'fault': 0.34; 'occurs': 0.34; 'sometimes,': 0.34; 'test.': 0.34; 'something': 0.35; 'test': 0.35; 'project': 0.35; 'however,': 0.36; 'connection': 0.36; 'presence': 0.36; 'subject:with': 0.36; 'themselves.': 0.37; 'but': 0.37; 'run': 0.37; 'another': 0.37; 'could': 0.37; 'doing': 0.38; 'somewhat': 0.38; 'received:org': 0.38; 'some': 0.38; 'e.g.': 0.39; 'difficult': 0.39; "i'd": 0.39; 'should': 0.39; 'to:addr:python.org': 0.40; 'might': 0.40; 'hours': 0.60; 'more': 0.61; 'your': 0.61; 'kind': 0.61; 'happen': 0.61; 'order': 0.62; 'life': 0.64; 'believe': 0.65; 'proved': 0.67; '100': 0.70; 'imagine': 0.71; 'order,': 0.73; 'succeed': 0.73; 'records': 0.74; 'gain': 0.75; 'million': 0.76; 'article,': 0.84; 'harness': 0.84; 'rockets': 0.84; 'existed': 0.91; 'seriously,': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: replacing __dict__ with an OrderedDict
Date Mon, 09 Jan 2012 23:21:21 -0500
References <hjsit8-j0a.ln1@satorlaser.homedns.org> <mailman.4476.1325850201.27778.python-list@python.org> <pv9jt8-uva.ln1@satorlaser.homedns.org> <je79dp$bg5$1@dough.gmane.org> <mailman.4488.1325870461.27778.python-list@python.org> <roy-09BCB2.09350909012012@news.panix.com> <11jrt8-l32.ln1@satorlaser.homedns.org> <roy-2E09FC.20055009012012@news.panix.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-74-109-121-73.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
In-Reply-To <roy-2E09FC.20055009012012@news.panix.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.4576.1326169307.27778.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326169307 news.xs4all.nl 6905 [2001:888:2000:d::a6]:55083
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18730

Show key headers only | View raw


On 1/9/2012 8:05 PM, Roy Smith wrote:
> In article<11jrt8-l32.ln1@satorlaser.homedns.org>,
>   Ulrich Eckhardt<ulrich.eckhardt@dominolaser.com>  wrote:
>
>>> Some people advocate that the test framework should
>>> intentionally randomize the order, to flush out inter-test dependencies
>>> that the author didn't realize existed (or intend).
>>
>> If you now
>> happen to influence one test with another and the next run randomizes
>> the tests differently, you will never see the fault again. Without this
>> reproducability, you don't gain anything but the bad stomach feeling
>> that something is wrong.
>
> The standard solution to that is to print out the PRNG initialization
> state and provide a way in your test harness to re-initialize it to that
> state.  I've done things like that in test scenarios where it is
> difficult or impossible to cover the problem space deterministically.
>
>> Your unfortunate case is where test X creates persistent state that must
>> be present in order for test X+1 to produce meaningful results. This
>> kind of dependency obviously blows, as it means you can't debug test X+1
>> separately. I'd call this operational dependency.
>>
>> This kind of dependency is IMHO a bug in the tests themselves.
>
> For the most part, I'm inclined to agree.  However, there are scenarios
> where having each test build the required state from scratch is
> prohibitively expensive.  Imagine if you worked at NASA wanted to run
> test_booster_ignition(), test_booster_cutoff(),
> test_second_stage_ignition(), and test_self_destruct().  I suppose you
> could run them in random order, but you'd use up a lot of rockets that
> way.
>
> Somewhat more seriously, let's say you wanted to do test queries against
> a database with 100 million records in it.  You could rebuild the
> database from scratch for each test, but doing so might take hours per
> test.  Sometimes, real life is just *so* inconvenient.
>
>> There is another dependency and that I'd call a logical dependency. This
>> occurs when e.g. test X tests for an API presence and test Y tests the
>> API behaviour. In other words, Y has no chance to succeed if X already
>> failed.
>
> Sure.  I run into that all the time.  A trivial example would be the
> project I'm working on now.  I've come to realize that a long unbroken
> string of E's means, "Dummy, you forgot to bring the application server
> up before you ran the tests".  It would be nicer if the test suite could
> have run a single test which proved it could create a TCP connection and
> when that failed, just stop.

Many test cases in the Python test suite have multiple asserts. I 
believe both resource sharing and sequential dependencies are reasons. I 
consider 'one assert (test) per testcase' to be on a par with 'one class 
per file'.

-- 
Terry Jan Reedy

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


Thread

replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-06 10:48 +0100
  Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-06 22:43 +1100
    Re: replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-06 14:36 +0100
      Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-07 04:01 +1100
        Re: replacing __dict__ with an OrderedDict Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-07 00:45 +0000
      Re: replacing __dict__ with an OrderedDict Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-06 10:20 -0700
        Re: replacing __dict__ with an OrderedDict Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-07 00:49 +0000
          Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-07 12:21 +1100
          Re: replacing __dict__ with an OrderedDict Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-06 18:24 -0700
            Re: replacing __dict__ with an OrderedDict Eelco <hoogendoorn.eelco@gmail.com> - 2012-01-08 14:03 -0800
              Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-09 23:10 +1100
                Re: replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-09 14:16 +0100
                Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-10 23:31 +1100
                Re: replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-10 18:21 +0100
        Re: replacing __dict__ with an OrderedDict Roy Smith <roy@panix.com> - 2012-01-09 09:35 -0500
          Re: replacing __dict__ with an OrderedDict Neil Cerutti <neilc@norwich.edu> - 2012-01-09 14:52 +0000
          Re: replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-09 17:59 +0100
            Re: replacing __dict__ with an OrderedDict Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-09 10:30 -0700
            Re: replacing __dict__ with an OrderedDict Roy Smith <roy@panix.com> - 2012-01-09 20:05 -0500
              Re: replacing __dict__ with an OrderedDict Terry Reedy <tjreedy@udel.edu> - 2012-01-09 23:21 -0500
              Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-10 23:22 +1100
                Re: replacing __dict__ with an OrderedDict Roy Smith <roy@panix.com> - 2012-01-10 09:05 -0500
                Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-11 02:57 +1100
                Re: replacing __dict__ with an OrderedDict Roy Smith <roy@panix.com> - 2012-01-10 21:47 -0500
                Re: replacing __dict__ with an OrderedDict Tim Wintle <tim.wintle@teamrubber.com> - 2012-01-10 15:45 +0000
            Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-10 23:46 +1100
      Re: replacing __dict__ with an OrderedDict Lie Ryan <lie.1296@gmail.com> - 2012-01-07 04:42 +1100
  Re: replacing __dict__ with an OrderedDict Peter Otten <__peter__@web.de> - 2012-01-06 12:44 +0100
    Re: replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-06 14:40 +0100
      Re: replacing __dict__ with an OrderedDict Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-06 09:06 -0700
        Re: replacing __dict__ with an OrderedDict alex23 <wuwei23@gmail.com> - 2012-01-08 20:58 -0800
      Re: replacing __dict__ with an OrderedDict Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-06 09:07 -0700
      Re: replacing __dict__ with an OrderedDict Arnaud Delobelle <arnodel@gmail.com> - 2012-01-06 21:38 +0000
    Re: replacing __dict__ with an OrderedDict Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-18 11:29 +0100
  Re: replacing __dict__ with an OrderedDict Ethan Furman <ethan@stoneleaf.us> - 2012-01-06 06:13 -0800
  Re: replacing __dict__ with an OrderedDict Arnaud Delobelle <arnodel@gmail.com> - 2012-01-06 21:32 +0000

csiph-web