472,347 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

Wierd Test Failure

Hello. Im using doctests to check the functions that ive made. Wat i
dnt understand is that it gives me a fialure even though the expected
and got values are the same. Check this out:

************************************************** ********************
File "C:\Python25\Lib\idlelib\idle.pyw", line ?, in
__main__.Test.test8
Failed example:
Test.test8()
Expected:
True
Got:
True
************************************************** ********************

If both the values are returning True how is it possible for the test
to fail? :S
Jun 27 '08 #1
1 967
J-Burns wrote:
Hello. Im using doctests to check the functions that ive made. Wat i
dnt understand is that it gives me a fialure even though the expected
and got values are the same. Check this out:

************************************************** ********************
File "C:\Python25\Lib\idlelib\idle.pyw", line ?, in
__main__.Test.test8
Failed example:
Test.test8()
Expected:
True
Got:
True
************************************************** ********************

If both the values are returning True how is it possible for the test
to fail? :S
Here's one way:

$ cat tmp.py
"""
>>print " \bTrue"
True
"""
import doctest
doctest.testmod()
$ python tmp.py
************************************************** ********************
File "tmp.py", line 2, in __main__
Failed example:
print "True"
Expected:
True
Got:
True
************************************************** ********************
1 items had failures:
1 of 1 in __main__
***Test Failed*** 1 failures.

" \bTrue" and "True" look the same but won't pass the equality test
performed by doctest.

As a side note, consider putting your own code in a separate file outside
the python distribution. Otherwise you risk messing up python and producing
more "weird" errors.

Peter
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Parkes | last post by:
Because Active State haven't yet built the additional modules I will require I'm trying to build Perl 5.8.0 from source using dmake and the Borland...
3
by: Markus Fischer | last post by:
Hi, I'm experiencing a wierd problem with IE 6 in Windows with two _slightly_ different Version. Give the following HTMl-Code, ideally the...
6
by: Qun Cao | last post by:
Hello, I am just starting to play threading in python, here is a really interesting problem I am very curious about: " import thread def...
2
by: CMEDIA_SOUND | last post by:
I have a peculiar problem, I have a tabpage with a label control on it. When i set a background image to the tabpage and drag the label around it...
1
by: cody | last post by:
I have a OOP problem with the well known pattern where objects containing an object which represents a list of subobjects. Now my problem is that...
3
by: Niloday | last post by:
Hi All, I have developed a web service and deployed it on the Win2000 box. I can access the web methods of this web service when my client...
4
by: Muthu Arumugam | last post by:
Tried the following c# code static void Main(string args) { ArrayList list = new ArrayList(); int i = 10;
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed...
1
by: Cirene | last post by:
I'm having some wierd paging issues with a gridview. Here it is: http://www.gulfstreamonline.com/NonAuctions.aspx Page 2 is empty Page 3-5...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.