[PATCH 4 of 4] test-doctest: normalize b'', u'' and exception name on Python 3

Yuya Nishihara yuya at tcha.org
Fri Aug 25 10:15:03 EDT 2017


On Fri, 25 Aug 2017 00:20:43 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1503581608 -32400
> #      Thu Aug 24 22:33:28 2017 +0900
> # Node ID 098312faf83c46ea590c0c865874ccfc2f1b4df7
> # Parent  a9b6c464c13b6a6d7dce4e8adf88d0e80dc96003
> test-doctest: normalize b'', u'' and exception name on Python 3

> +class py3docchecker(doctest.OutputChecker):
> +    def check_output(self, want, got, optionflags):
> +        want2 = re.sub(r'''\bu(['"])(.*?)\1''', r'\1\2\1', want)  # py2: u''
> +        got2 = re.sub(r'''\bb(['"])(.*?)\1''', r'\1\2\1', got)  # py3: b''
> +        got2 = re.sub(r'^mercurial\.error\.', '', got2)  # exception name

Perhaps this should be flagged as re.MULTILINE. I'll resend this. The other
patches can be queued separately.


More information about the Mercurial-devel mailing list