[Python-Dev] Unittest/doctest formatting differences in 2.7a1?

Lennart Regebro regebro at gmail.com
Fri Dec 11 21:32:58 CET 2009

On Thu, Dec 10, 2009 at 21:24, Benjamin Peterson <benjamin at python.org> wrote:
> 2009/12/10 Lennart Regebro <regebro at gmail.com>:
> > On Thu, Dec 10, 2009 at 20:25, Terry Reedy <tjreedy at udel.edu> wrote:
> >> Since the intent of IGNORE_EXCEPTION_DETAIL is to make doctests immune to
> >> implementation version specific changes, it seems to me that extending its
> >> technical meaning is required to carry out its intent.
> >
> > Would this be considered bugfixy enough to get into 3.1-branch as well
> > as 2.7? It really is damn annoying when you try to port doctests to
> > Python 3, and it would be great if we wouldn't have to wait for 3.2.
> I think a patch would be helpful before deciding that.

Should I start a bug report in the tracker for this?

The diff in the code is:

                 # Another chance if they didn't care about the detail.
                 elif self.optionflags & IGNORE_EXCEPTION_DETAIL:
-                    m1 = re.match(r'[^:]*:', example.exc_msg)
-                    m2 = re.match(r'[^:]*:', exc_msg)
-                    if m1 and m2 and check(m1.group(0), m2.group(0),
+                    m1 = re.match(r'(?:[^:]*\.)?([^:]*:)', example.exc_msg)
+                    m2 = re.match(r'(?:[^:]*\.)?([^:]*:)', exc_msg)
+                    if m1 and m2 and check(m1.group(1), m2.group(1),
                         outcome = SUCCESS

But obviously I have patches for both py3k and trunk with tests and
updated documentation as well.
As you see the diff is pretty simple, it's just a more complex regex.
Lennart Regebro: Python, Zope, Plone, Grok
+33 661 58 14 64

More information about the Python-Dev mailing list