473,395 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 1004
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 C++ command line compiler from the cmd.exe...
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 output of offsetTop should be "105"; a few pixel...
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 main(): thread.start_new(test.()) def test():
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 has paint issues in that it is slow, granted the...
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 the ctor of a subobject indirectly calls the...
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 application is debugged from VS.NET studio. But it...
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 would be to teach the students how they might write...
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 have 1 item each Any ideas why?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.