UNITTEST problem!!! :(
Peter Hansen
peter at engcorp.com
Tue Feb 11 16:20:38 EST 2003
andrea frosoni wrote:
>
> the code listed down is correct???
> don't work right
>
> Help me
>
> def testFunc1(self):
> "Test func1"
> # call func1
> ret = self.pingObj.func1(
> host = '194.183.3.41', #sample host for ping
> num = '10') #number of packets sent
> self.assertEqual(ret, 10, "ping.func1 did not work")#10
> number of #packet shoud be return#
> return
>
> def testFunc2(self):
> "Test func2"
> # call func2
> ret = self.pingObj.func2()
> self.failUnless(ret, "ping.func2 did not work")
> return
Always *always* post the traceback for your failure, showing the
exact error message and the line of code that failed. (Note: don't
re-enter it either, just use cut-and-paste to stick it in the message.)
Without that, we don't know what didn't work and obviously cannot
run your code above as it is missing many necessary pieces.
Rather than make us come up with dozens of theories about what
*might* have gone wrong, please just tell us.
(Theory 1: your indentation is screwed up because the first
function seems to be indented 0 colummns, while the second
one is indented four columns... I really doubt that's your
only problem though, and it was probably just a side-effect
of pasting the text in.)
-Peter
More information about the Python-list
mailing list