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


Groups > comp.lang.python > #83604

Re: annoying doctest problem

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'output': 0.05; 'string': 0.09; 'doctest': 0.09; 'escape': 0.09; 'output,': 0.09; 'cc:addr:python-list': 0.11; 'dumb.': 0.16; 'peters': 0.16; 'repr': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'language': 0.16; 'programming': 0.22; 'rules': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'string,': 0.24; 'subject:problem': 0.24; 'typical': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'first,': 0.26; 'header:In- Reply-To:1': 0.27; 'thus': 0.29; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; 'comparison': 0.31; 'doc': 0.31; 'another': 0.32; 'text': 0.33; 'implemented': 0.33; 'actual': 0.34; 'comment': 0.34; 'problem.': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'expected': 0.38; 'does': 0.39; 'embedded': 0.39; 'skip:u 10': 0.60; 'simple': 0.61; 'first': 0.61; 'exchange': 0.63; 'therefore,': 0.64; 'more': 0.64; 'different': 0.65; 'safe': 0.72
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tbmuZtPWMDRRXZevdOQLINuFxZ9vgKnVJoKST/kxW10=; b=wi4MB4gPSGLxqroKePuJw5lqZyG2Y7OhB+p/Wtgq/PXs7hia32gccWiRl9zm1glenu cJrqTz0d7Ge1s9EwxMOjNq9B/V0721OUU2GktrybROQnObCdMzzGi2b6RHcJSu7JoUmT KYKVDh31pegWcx+NfGu6o/ksPwMSPYweiBrV0Kt842oVSc6XrbbVBV8wShUpkjqve7Yi GhbGeQzsl1kV0QDr3RMQlccNtwzvx6iATMpxC3dIEwuxoeuqAy591cq5lFYtZNIYmuI0 RXxtVWSNndWyHO5bZEsl1TLJm1mOZ3ZdbSjGEUjPtdFxSaRiAhgfOr432tSuD6ZNS8LX wI5Q==
MIME-Version 1.0
X-Received by 10.202.60.4 with SMTP id j4mr15956039oia.83.1421064943306; Mon, 12 Jan 2015 04:15:43 -0800 (PST)
In-Reply-To <54b35a9c$0$2738$c3e8da3$76491128@news.astraweb.com>
References <0e9e5a03-2291-490e-9220-fa6744c9e2e5@googlegroups.com> <54b35a9c$0$2738$c3e8da3$76491128@news.astraweb.com>
Date Mon, 12 Jan 2015 06:15:42 -0600
Subject Re: annoying doctest problem
From Skip Montanaro <skip.montanaro@gmail.com>
To "Steven D'Aprano" <steve@pearwood.info>
Content-Type multipart/alternative; boundary=001a113cd36e260ef8050c737723
Cc Python <python-list@python.org>
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.17618.1421064945.18130.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1421064945 news.xs4all.nl 2936 [2001:888:2000:d::a6]:36309
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83604

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

ISTR that when Tim Peters first implemented first, the typical way you were
expected to get tests into a doc string was to copy from an interactive
session, which would not have this problem.

Also, to Steven's comment about fussiness, it isn't so much that it's
fussy. It's more that it's dumb. I just does a simple string comparison of
the expected and actual outputs. It would be impossible for doctest to know
whether the expected output was something like repr or str output, and thus
safe to exchange single for double (don't forget to escape other embedded
quotes!), or was some sort of user-generated string, perhaps intended to be
text in  another programming language which has different quoting rules
than Python. Therefore, fussy (or dumb) is exactly what you want.

I-said-what-I-meant-ly y'rs,

Skip

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