Unit test failing please help
Tim Wintle
tim.wintle at teamrubber.com
Fri Aug 26 11:52:43 EDT 2011
On Fri, 2011-08-26 at 08:35 -0700, lblake wrote:
> Hi I am new to python I am at bit lost as to why my unit test is
> failing below is the code and the unit test:
>
> class Centipede(object):
> legs, stomach
This doesn't do what you think it does.
"legs, stomach" is a statement and is not defining any variables at all.
Presumably you've also got variables named legs and stomach in the
module's scope - as I'd expect to see a NameError : name 'legs' is not
defined.
(I'd also expect a SyntaxError from having an empty __init__ function
body)
You probably want do write something like this:
class Centipede(object):
def __init__(self):
self.legs = []
self.stomach = []
More information about the Python-list
mailing list