Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'doctest': 0.09; 'naturally': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:blog': 0.10; 'code?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tool.': 0.16; 'unexpected': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'subject:problem': 0.24; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; 'appreciated.': 0.29; "i'm": 0.30; 'code': 0.31; 'actual': 0.34; 'problem': 0.35; 'something': 0.35; 'equal': 0.35; 'test': 0.35; 'but': 0.35; 'limitations': 0.36; 'detail': 0.37; 'too': 0.37; 'two': 0.37; 'expected': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; "you're": 0.61; 'here:': 0.62; 'email addr:gmail.com': 0.63; 'more': 0.64; 'occur': 0.65; 'charset:windows-1252': 0.65; 'evaluate': 0.72 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: annoying doctest problem Date: Mon, 12 Jan 2015 10:47:25 -0500 References: <0e9e5a03-2291-490e-9220-fa6744c9e2e5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 18.189.14.118 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: <0e9e5a03-2291-490e-9220-fa6744c9e2e5@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421077657 news.xs4all.nl 2892 [2001:888:2000:d::a6]:36052 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83613 On 1/11/15 11:20 PM, gordianknot1981@gmail.com wrote: > > It failed with an unknown reason that evaluate two expected equal value but got an unexpected result! I'm struggling with this problem for a long time. Did I did something wrong? And how do I to fix it? > > any help is appreciated. :) > My recommendation is to use doctest to test the code samples that naturally occur in your docstrings, but not to use it as a general-purpose testing tool. It has too many limitations and quirks, and if you're going to write separate test methods anyway, why not just write actual code? More detail here: http://nedbatchelder.com/blog/200811/things_i_dont_like_about_doctest.html -- Ned Batchelder, http://nedbatchelder.com