Issue 1508564: "...." (four dots) confuses doctest's ellipsis matching (original) (raw)
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.
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>
).