[Tutor] Unexpected Behavior in unittest
Carroll, Barry
Barry.Carroll at psc.com
Tue Feb 28 23:30:58 CET 2006
Danny:
I wish it were that simple. 'test3.py' is the name of the file
containing the test case class. I left the invocation out of my output
excerpt. It should look like this:
>>>>>>>>>>>>>>>>>>>>>>>>
J:\My Documents\Projects\Mongoose\symgen\test3.py
F
======================================================================
FAIL: test_cs (__main__.cs_tryout)
----------------------------------------------------------------------
Traceback (most recent call last):
File "J:\My Documents\Projects\Mongoose\symgen\test3.py", line 25, in
test_cs
<<<snip>>>
FAILED (failures=1)
>>>>>>>>>>>>>>>>>>>>>>>>
BTW the other code excerpt was from a file named 'test1.py' in the same
directory.
Regards,
Barry
barry.carroll at psc.com
541-302-1107
________________________
We who cut mere stones must always be envisioning cathedrals.
-Quarry worker's creed
> -----Original Message-----
> From: Danny Yoo [mailto:dyoo at hkn.eecs.berkeley.edu]
> Sent: Tuesday, February 28, 2006 2:08 PM
> To: Carroll, Barry
> Cc: tutor at python.org
> Subject: Re: [Tutor] Unexpected Behavior in unittest
>
>
> > In this case, the assignment to lg.cs failed.
> > >>>>>>>>>>>>>>>>>>>>>>
> > F
> >
======================================================================
> > FAIL: test_cs (__main__.cs_tryout)
> >
----------------------------------------------------------------------
> > Traceback (most recent call last):
> > File "J:\My Documents\Projects\Mongoose\symgen\test3.py", line 25,
in
> test_cs
> > self.assertEqual(expect, lg.cs, msg)
> > File "C:\PROGRA~1\Python23\lib\unittest.py", line 302, in
> failUnlessEqual
> > raise self.failureException, \
> > AssertionError: Generator cs is incorrect.
> > Expected 2.5; got 1.0
> >
>
> Hi Barry,
>
> I think the bug here is less glamorous than you might expect. I'd
> recommend rerunning the unit test again, and watch carefully about
what
> exactly you're running.
>
> It's strongly possible that you may be running the wrong test program:
I
> see a reference to a 'test3.py' there in the error message that dies
on
> the line:
>
> self.assertEqual(expect, lg.cs, msg)
>
> But, hunting through the class that you've shown us, I see no such
line.
> *grin*
>
> The simplest explanation is that you're not running the test program
that
> you think you're running. Double check that you mean to run
'test3.py',
> as opposed to some other 'test*' program in your working directory.
>
>
> Good luck!
>
>
>
More information about the Tutor
mailing list