[ python-Bugs-1508564 ] "...." (four dots) confuses doctest's ellipsis matching

SourceForge.net noreply at sourceforge.net
Mon Jun 19 14:20:41 CEST 2006


Bugs item #1508564, was opened at 2006-06-19 07:42
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1508564&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Bennetts (spiv)
Assigned to: Nobody/Anonymous (nobody)
Summary: "...." (four dots) confuses doctest's ellipsis matching

Initial Comment:
Consider this snippet:

from doctest import OutputChecker, ELLIPSIS
print OutputChecker().check_output('AAA....',
'AAA.BBB', ELLIPSIS)

I expect that to print True, but instead it prints False.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2006-06-19 08:20

Message:
Logged In: YES 
user_id=31435

Sorry, but this won't change.  As in most simple parsers, a
"maximal munch" rule is at work for recognizing
multi-character tokens:  your pattern gets parsed as

    "AAA" <ellipsis> "."

not as

    "AAA." <ellipsis>

or as

    "AAA...."

Therefore it matches all and only those strings that begin
with "AAA" and end with ".".

The maximal-munch rules gives an easy-to-predict way of
resolving ambiguous inputs, but you're stuck with the way it
 picks.  Because of this, there is no direct way to use
ELLIPSIS to get the effect I'm guessing you want (i.e., I'm
guessing you want it parsed as

    "AAA." <ellipsis>

).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1508564&group_id=5470


More information about the Python-bugs-list mailing list