Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Gabriel Genellina
En Fri, 23 Apr 2010 03:15:16 -0300, Cameron Simpson escribió: On 23Apr2010 15:37, I wrote: | Experienced users will see at once what's happened: I've made a Node | myself in the test using the local class, and the Node class is thus | __main__.Node. However, my sql Backend class has independ

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Terry Reedy
On 4/23/2010 8:03 AM, Cameron Simpson wrote: On 23Apr2010 13:25, Peter Otten<__pete...@web.de> wrote: | Move the unit tests into a separate script and have that import the module | cs.nodedb.node. Hmm. I have been very attracted by the idea of having the unittest in the module itself, and ru

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Cameron Simpson
On 23Apr2010 13:25, Peter Otten <__pete...@web.de> wrote: | Cameron Simpson wrote: | > and it's failing. I've traced the failure cause, ending up with this | > assertion message from the end of serialise() above: | > | > AssertionError: HOST:foo:{}'cs.nodedb.node.Node'> | > | > Experienced

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Peter Otten
Cameron Simpson wrote: > and it's failing. I've traced the failure cause, ending up with this > assertion message from the end of serialise() above: > > AssertionError: HOST:foo:{}'cs.nodedb.node.Node'> > > Experienced users will see at once what's happened: I've made a Node > myself in t

question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Cameron Simpson
I've run into a problem unittesting something I'm writing. I have a little node tracking class I'm using to track items and attributes. An item is a "Node" object, and the collection is a "NodeDB". So I'm writing some unittests, thus: class Node(dict): [...] class NodeDB(dic): [...] class

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Cameron Simpson
On 23Apr2010 16:15, I wrote: | On 23Apr2010 15:37, I wrote: | | class Backend(object): | | def serialise(self, value): | | ''' Convert a value for external string storage. | | ''' | | if isinstance(value, Node): [...] | | return ":%s:%s" % (value.type, value.name) |

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-22 Thread Cameron Simpson
On 23Apr2010 15:37, I wrote: | class Backend(object): | def serialise(self, value): | ''' Convert a value for external string storage. | ''' | if isinstance(value, Node): [...] | return ":%s:%s" % (value.type, value.name) | t = type(value) | assert t in (