doctest's ELLIPSIS

Discussion in 'Python' started by =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=, Apr 29, 2005.

  1. Hi,

    Can anybody come up with a sensible argument that would explain
    why the following test should fail ? (Expected: nothing, Got: 42).

    cheers,

    S.B.

    ----------------------------------------
    #!/usr/bin/env python

    import doctest

    def test():
    """
    >>> print 42 #doctest: +ELLIPSIS

    ...
    """

    def run():
    "Run the test."
    doctest.testmod()

    if __name__ == '__main__':
    run()

    ----------------------------------------
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=, Apr 29, 2005
    #1
    1. Advertising

  2. I think doctest believes the line starting with ... is
    a continuation line in a multiline statement.
    Michele Simionato, Apr 29, 2005
    #2
    1. Advertising

  3. Doh ! Obviously ... too bad.

    I guess that I could set doctest.ELLIPSIS_MARKER to "[...]" to
    distinguish
    the two usages of "...". (The "..." used for multiline statements is
    hard-coded
    into a regular expression pattern).

    But it feels too hackish, ELLIPSIS_MATKER being not described in the
    docs ...

    Well, anyway, thanks for your insight.

    S.B.
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=, Apr 29, 2005
    #3
  4. I would file a bug report/documentation bug/feature
    request or whatever to sourceforge.

    Michele Simionato
    Michele Simionato, Apr 29, 2005
    #4
  5. Done.
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=, Apr 29, 2005
    #5
  6. (Forwarded from Python bug tracker)

    [ 1192554 ] doctest's ELLIPSIS and multiline statements

    Tim Peters:
    [...]
    doctest has few syntax requirements, but the
    inability to start an expected output block with "..." has
    always been one of them, and is independent of the
    ELLIPSIS gimmick. I doubt this will change, in part because
    the complications needed to "do something about it" are
    probably pig ugly, in part because it's so rare a desire, and
    in part because there are easy ways to work around it (like
    arranging for the expected output to start with something
    other than '...').
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=, May 2, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    2
    Views:
    514
    Hans Kesting
    Feb 14, 2006
  2. Chris Perkins

    Ellipsis outside a slice

    Chris Perkins, Oct 8, 2003, in forum: Python
    Replies:
    1
    Views:
    921
    Terry Reedy
    Oct 9, 2003
  3. Wayne Folta

    Ellipsis usage?

    Wayne Folta, Feb 18, 2004, in forum: Python
    Replies:
    2
    Views:
    4,897
    Peter Otten
    Feb 18, 2004
  4. =?iso-8859-1?q?Jonas_K=F6lker?=

    !wtf ellipsis

    =?iso-8859-1?q?Jonas_K=F6lker?=, Aug 13, 2004, in forum: Python
    Replies:
    6
    Views:
    577
    Erik Max Francis
    Aug 15, 2004
  5. Jerry Sievers

    slicing, mapping types, ellipsis etc.

    Jerry Sievers, Nov 29, 2004, in forum: Python
    Replies:
    9
    Views:
    355
    Kent Johnson
    Nov 30, 2004
Loading...

Share This Page