Mercurial > public > mercurial-scm > hg-stable
diff tests/test-doctest.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 431cf2c8c839 |
children | aef7b043a36f |
line wrap: on
line diff
--- a/tests/test-doctest.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/test-doctest.py Sun Oct 06 09:45:02 2019 -0400 @@ -7,22 +7,30 @@ import re import sys -ispy3 = (sys.version_info[0] >= 3) +ispy3 = sys.version_info[0] >= 3 if 'TERM' in os.environ: del os.environ['TERM'] + 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'' # py3: <exc.name>: b'<msg>' -> <name>: <msg> # <exc.name>: <others> -> <name>: <others> - got2 = re.sub(r'''^mercurial\.\w+\.(\w+): (['"])(.*?)\2''', r'\1: \3', - got2, re.MULTILINE) + got2 = re.sub( + r'''^mercurial\.\w+\.(\w+): (['"])(.*?)\2''', + r'\1: \3', + got2, + re.MULTILINE, + ) got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE) - return any(doctest.OutputChecker.check_output(self, w, g, optionflags) - for w, g in [(want, got), (want2, got2)]) + return any( + doctest.OutputChecker.check_output(self, w, g, optionflags) + for w, g in [(want, got), (want2, got2)] + ) + def testmod(name, optionflags=0, testtarget=None): __import__(name) @@ -40,6 +48,7 @@ runner.run(test) runner.summarize() + testmod('mercurial.changegroup') testmod('mercurial.changelog') testmod('mercurial.cmdutil')