Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp C.T. Matsumoto
Johnny deBris wrote: it is usually not bad to change your code to improve testability. I suppose that should be the rule of thumb. T -- C.T. Matsumoto Claes de Vrieselaan 60a III 3021 JR Rotterdam The Netherlands tel.: +31 (0)6 41 45 08 54 ___ Pyth

Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp Johnny deBris
C.T. Matsumoto wrote: At least for this example, it seems funny that some of the convenience functions on a type, when strung together can do some pretty weird things that need checking, but nevertheless are nicely placed in the function your are using them in. A better example is re. Yes, th

Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp C.T. Matsumoto
Cheers Guido, Yeah I'm with you that you should not be testing *how* the function is going about doing things... but lets say your making a function to format string output. On the one hand your function contains everything nicely enough, without bifurcating the code into lots of small pieces.

Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp C.T. Matsumoto
Konrad Delong wrote: On 23 April 2010 11:56, C.T. Matsumoto wrote: Hello all, Does anyone know a good way to test function objects? It's easy enough to test class attributes, but for some reason I'm finding it difficult to test if a function has the right 'attributes'. I'm using unittest and

Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp Johnny deBris
C.T. Matsumoto wrote: Does anyone know a good way to test function objects? It's easy enough to test class attributes, but for some reason I'm finding it difficult to test if a function has the right 'attributes'. Do you mean local variables? In that case, I would suggest not to test those -

Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp Zaheer Soebhan
Maybe you should raise an exception when x or y have the wrong value, because you don't want the wrong local variables in your function anyway, I assume. Then (unit)test if this actually happens with the "wrong" parameters in your function. Gr, Zaheer 2010/4/23 Konrad Delong > On 23 April 2010

Re: [python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp Konrad Delong
On 23 April 2010 11:56, C.T. Matsumoto wrote: > Hello all, > > Does anyone know a good way to test function objects? It's easy enough to > test class attributes, but for some reason I'm finding it difficult to test > if a function has the right 'attributes'. > > I'm using unittest and nosetests. >

[python-nl] testing

2010-04-23 Berichten over hetzelfde onderwerp C.T. Matsumoto
Hello all, Does anyone know a good way to test function objects? It's easy enough to test class attributes, but for some reason I'm finding it difficult to test if a function has the right 'attributes'. I'm using unittest and nosetests. Sample function: def foo(): x = 3 y = 4 This