Unittest - testing properties (read-only attributes)

Roy Smith roy at panix.com
Mon Feb 21 12:59:05 EST 2005


Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:
>  The example I quoted used an assignment expression inside a
> lambda.  The person who posted it,

That was me.

> and the person who followed it up
> with the setattr alternative, both didn't notice that the assignment
> expression wasn't valid Python.

Ugh.  No, I hadn't noticed it.  Thanks for pointing it out.

I don't use lambdas much.  In fact, the only time I ever do use them is for 
an assertRaises unit test.  I've always thought that "assignment is  a 
statement not an expression" was one of Python's warts, and this is just 
another example of why it is.  Of course, "lambda isn't just a def body" is 
a wart too :-)

> However, my post came out sounding
> grumpier than I intended ;).

Actually, I hadn't noticed that either. :-)



More information about the Python-list mailing list