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


Groups > comp.lang.python > #83604

Re: annoying doctest problem

References <0e9e5a03-2291-490e-9220-fa6744c9e2e5@googlegroups.com> <54b35a9c$0$2738$c3e8da3$76491128@news.astraweb.com>
Date 2015-01-12 06:15 -0600
Subject Re: annoying doctest problem
From Skip Montanaro <skip.montanaro@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.17618.1421064945.18130.python-list@python.org> (permalink)

Show all headers | 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