Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12234

Re: Unit test failing please help

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <tim.wintle@teamrubber.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:test': 0.05; 'does.': 0.07; 'x-mailer:evolution 2.28.3': 0.07; 'python': 0.08; 'defined.': 0.09; "module's": 0.09; 'def': 0.15; "(i'd": 0.16; '__init__': 0.16; 'body)': 0.16; 'failing': 0.16; 'nameerror': 0.16; 'cc:addr:python-list': 0.16; 'this:': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.20; "doesn't": 0.22; 'subject:help': 0.22; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'subject:please': 0.24; 'expect': 0.25; 'code': 0.25; 'statement': 0.25; 'function': 0.27; 'bit': 0.28; 'cc:addr:python.org': 0.30; 'class': 0.30; 'probably': 0.33; 'named': 0.33; 'test': 0.34; 'all.': 0.34; 'defining': 0.34; 'fri,': 0.36; 'variables': 0.37; 'something': 0.37; 'think': 0.38; 'subject:: ': 0.39; 'header :Mime-Version:1': 0.39; 'empty': 0.39; 'why': 0.39; "i'd": 0.40; 'below': 0.62; 'lost': 0.68; 'header:Reply-To:1': 0.71; 'reply- to:no real name:2**0': 0.71; '08:35': 0.84; 'legs,': 0.84; 'received:bethere.co.uk': 0.84; 'legs': 0.93; 'presumably': 0.93
Subject Re: Unit test failing please help
From Tim Wintle <tim.wintle@teamrubber.com>
To lblake <treleven.lloyd@gmail.com>
In-Reply-To <ccbce61b-77e3-44fc-bbb8-fbd7007326dd@w28g2000yqw.googlegroups.com>
References <ccbce61b-77e3-44fc-bbb8-fbd7007326dd@w28g2000yqw.googlegroups.com>
Content-Type text/plain; charset="UTF-8"
Organization Team Rubber
Date Fri, 26 Aug 2011 16:52:43 +0100
Mime-Version 1.0
X-Mailer Evolution 2.28.3
Content-Transfer-Encoding 7bit
X-SA-Exim-Connect-IP 87.194.110.230
X-SA-Exim-Mail-From tim.wintle@teamrubber.com
X-SA-Exim-Scanned No (on mail.netsight.co.uk); SAEximRunCond expanded to false
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To tim.wintle@teamrubber.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.449.1314376532.27778.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314376532 news.xs4all.nl 2458 [2001:888:2000:d::a6]:36058
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12234

Show key headers only | View raw


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 = []

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Unit test failing please help lblake <treleven.lloyd@gmail.com> - 2011-08-26 08:35 -0700
  Re: Unit test failing please help John Gordon <gordon@panix.com> - 2011-08-26 15:58 +0000
  Re: Unit test failing please help Tim Wintle <tim.wintle@teamrubber.com> - 2011-08-26 16:52 +0100

csiph-web