Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > replacing __dict__ with an OrderedDict

Reply
Thread Tools

replacing __dict__ with an OrderedDict

 
 
Roy Smith
Guest
Posts: n/a
 
      01-10-2012
In article <mailman.4588.1326198152.27778.python->,
Lie Ryan <> wrote:

> On 01/10/2012 12:05 PM, Roy Smith wrote:
> > 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.

>
> All serious database has rollback feature when they're available to
> quickly revert database state in the setUp/cleanUp phase.


I guess MongoDB is not a serious database?
 
Reply With Quote
 
 
 
 
Tim Wintle
Guest
Posts: n/a
 
      01-10-2012
On Tue, 2012-01-10 at 09:05 -0500, Roy Smith wrote:
>
> I guess MongoDB is not a serious database?


That's opening up a can of worms


.... anyway, cassandra is far better.

Tim

 
Reply With Quote
 
 
 
 
Lie Ryan
Guest
Posts: n/a
 
      01-10-2012
On 01/11/2012 01:05 AM, Roy Smith wrote:
> In article<mailman.4588.1326198152.27778.python->,
> Lie Ryan<> wrote:
>
>> On 01/10/2012 12:05 PM, Roy Smith wrote:
>>> 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.

>>
>> All serious database has rollback feature when they're available to
>> quickly revert database state in the setUp/cleanUp phase.

>
> I guess MongoDB is not a serious database?


I guess there are always those oddball cases, but if you choose MongoDB
then you already know the consequences that it couldn't be as easily
unit-tested. And in any case, it is generally a bad idea to unittest
with a database that contains 100 million items, that's for performance
testing. So your point is?

 
Reply With Quote
 
Ulrich Eckhardt
Guest
Posts: n/a
 
      01-10-2012
Am 10.01.2012 13:31, schrieb Lie Ryan:
> While it is possible to replace __dict__ with OrderedDict and it is
> possible to reorder the test, those are not his original problem, and
> the optimal solution to his original problem differs from the optimal
> solution to what he think he will need.


Oh, and you know what is optimal in his environment? You really think
you know better what to do based on the little information provided?


> I had said this before and I'm saying it again: the problem is a test
> result displaying issue, not testing order issue.


There are good reasons for not reordering the results of the tests that
would be sacrificed by reordering them afterwards.


If you'd just step off your high horse you might actually learn
something instead of just ****ing people off.

Uli
 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      01-11-2012
In article <mailman.4603.1326211045.27778.python->,
Lie Ryan <> wrote:

> >> All serious database has rollback feature when they're available to
> >> quickly revert database state in the setUp/cleanUp phase.

> >
> > I guess MongoDB is not a serious database?

>
> I guess there are always those oddball cases, but if you choose MongoDB
> then you already know the consequences that it couldn't be as easily
> unit-tested. And in any case, it is generally a bad idea to unittest
> with a database that contains 100 million items, that's for performance
> testing. So your point is?


My point is that in the real world, what is practical and efficient and
sound business is not always what is theoretically correct.
 
Reply With Quote
 
Ulrich Eckhardt
Guest
Posts: n/a
 
      01-18-2012
Am 06.01.2012 12:44, schrieb Peter Otten:
[running unit tests in the order of their definition]
> class Loader(unittest.TestLoader):
> def getTestCaseNames(self, testCaseClass):
> """Return a sequence of method names found within testCaseClass
> sorted by co_firstlineno.
> """
> def first_lineno(name):
> method = getattr(testCaseClass, name)
> return method.im_func.__code__.co_firstlineno
>
> function_names = super(Loader, self).getTestCaseNames(testCaseClass)
> function_names.sort(key=first_lineno)
> return function_names


After using this a bit, it works great. I have up to now only found a
single problem, and that is that with decorated functions it doesn't
even get at the actual line number of the real code, so sorting by that
number doesn't work. An example for this is
"@unittest.expectedFailure(...)".

I can easily ignore this though, just wanted to give this feedback

Thanks again!

Uli
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an OrderedDict for __dict__ in Python 3 using __prepare__ Steven D'Aprano Python 0 01-09-2012 02:21 AM
Python 3: Plist as OrderedDict Gnarlodious Python 6 02-09-2010 04:07 PM
FYI: ConfigParser, ordered options, PEP 372 and OrderedDict + bigthank you Jonathan Fine Python 0 11-17-2009 04:59 PM
When is a __dict__ not a __dict__? Derek Fountain Python 1 04-21-2004 10:31 AM
__slots__ replacing __dict__ function anabell@sh163.net Python 1 11-06-2003 09:16 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57