[Tutor] Unexpected Behavior in unittest
Carroll, Barry
Barry.Carroll at psc.com
Wed Mar 1 21:13:30 CET 2006
Danny:
I went back and double checked all of my test files, and you were right
I was actually running an older version of test3.py. In that, the
assignment to the character separator was wrong:
lg.sc = 2.5
Having forgotten that Python allows dynamic creation of object
attributes at run time, I assumed (incorrectly) that the interpreter
would catch a misspelled attribute name. lg.sc was being assigned just
fine, leaving lg.cs blissfully unchanged. The test case caught the
error as it should, leaving me scratching my head and bothering you. A
case of C++ memory intruding into Python space.
Thank you for pointing out the real problem.
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:57 PM
> To: Carroll, Barry
> Cc: tutor at python.org
> Subject: RE: [Tutor] Unexpected Behavior in unittest
>
>
>
> > 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:
>
> Hi Barry,
>
>
> Ok.
>
> But still go back and make sure you're running the right file.
<<snip>>
> Python isn't magical, so I have to assume that some program,
> different than the one you've shown us, is being executed.
>
>
> Does this make sense?
>
More information about the Tutor
mailing list