Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83613

Re: annoying doctest problem

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 <python-python-list@m.gmane.org>
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 <ned@nedbatchelder.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17626.1421077657.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

annoying doctest problem gordianknot1981@gmail.com - 2015-01-11 20:20 -0800
  Re: annoying doctest problem gordianknot1981@gmail.com - 2015-01-11 20:30 -0800
  Re: annoying doctest problem Steven D'Aprano <steve@pearwood.info> - 2015-01-12 05:24 +0000
    Re: annoying doctest problem Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-12 06:15 -0600
      Re: annoying doctest problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-13 00:00 +1100
        Re: annoying doctest problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-12 14:59 +0000
          Re: annoying doctest problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-13 02:58 +1100
            Re: annoying doctest problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-12 16:46 +0000
        Re: annoying doctest problem Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-12 12:15 -0600
    Re: annoying doctest problem Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-12 06:32 -0600
  Re: annoying doctest problem Ned Batchelder <ned@nedbatchelder.com> - 2015-01-12 10:47 -0500
    Re: annoying doctest problem gordianknot1981@gmail.com - 2015-01-12 10:34 -0800

csiph-web