# HG changeset patch # User FUJIWARA Katsunori # Date 2019-02-17 15:27:25 # Node ID c70bdd222dcdb7ef5536783f5e540de4d0e9c4d0 # Parent cab32f08c994d7086fcb3af029913ac9a1f42b9a tests: bulk changes to avoid whitespace errors of check-code.py This is a part of preparation to apply checking with check-code.py on code fragments embedded in *.t test scripts. This revision avoids "whitespace" errors of check-code.py below: - missing whitespace after "," - missing whitespace in expression - no whitespace around "=" for named parameters - wrong whitespace around "=" diff --git a/tests/test-bundle2-pushback.t b/tests/test-bundle2-pushback.t --- a/tests/test-bundle2-pushback.t +++ b/tests/test-bundle2-pushback.t @@ -25,7 +25,8 @@ > b'key': b'new-server-mark', > b'old': b'', > b'new': b'tip'} - > encodedparams = [(k, pushkey.encode(v)) for (k,v) in params.items()] + > encodedparams = [(k, pushkey.encode(v)) + > for (k, v) in params.items()] > op.reply.newpart(b'pushkey', mandatoryparams=encodedparams) > else: > op.reply.newpart(b'output', data=b'pushback not enabled') diff --git a/tests/test-convert-cvs.t b/tests/test-convert-cvs.t --- a/tests/test-convert-cvs.t +++ b/tests/test-convert-cvs.t @@ -11,11 +11,11 @@ $ echo "[extensions]" >> $HGRCPATH $ echo "convert = " >> $HGRCPATH $ cat > cvshooks.py < def cvslog(ui,repo,hooktype,log): - > ui.write(b'%s hook: %d entries\n' % (hooktype,len(log))) + > def cvslog(ui, repo, hooktype, log): + > ui.write(b'%s hook: %d entries\n' % (hooktype, len(log))) > - > def cvschangesets(ui,repo,hooktype,changesets): - > ui.write(b'%s hook: %d changesets\n' % (hooktype,len(changesets))) + > def cvschangesets(ui, repo, hooktype, changesets): + > ui.write(b'%s hook: %d changesets\n' % (hooktype, len(changesets))) > EOF $ hookpath=`pwd` $ cat <> $HGRCPATH diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -640,7 +640,7 @@ import-checker.py or so on their content Make sure a broken uisetup doesn't globally break hg: $ cat > $TESTTMP/baduisetup.py < def uisetup(ui): - > 1/0 + > 1 / 0 > EOF Even though the extension fails during uisetup, hg is still basically usable: @@ -649,7 +649,7 @@ Even though the extension fails during u File "*/mercurial/extensions.py", line *, in _runuisetup (glob) uisetup(ui) File "$TESTTMP/baduisetup.py", line 2, in uisetup - 1/0 + 1 / 0 ZeroDivisionError: * by zero (glob) *** failed to set up extension baduisetup: * by zero (glob) Mercurial Distributed SCM (version *) (glob) diff --git a/tests/test-hgweb-no-request-uri.t b/tests/test-hgweb-no-request-uri.t --- a/tests/test-hgweb-no-request-uri.t +++ b/tests/test-hgweb-no-request-uri.t @@ -62,12 +62,12 @@ should be used from d74fc8dec2b4 onward > output = stringio() > env['PATH_INFO'] = '/' > env['QUERY_STRING'] = 'style=atom' - > process(hgweb.hgweb(b'.', name = b'repo')) + > process(hgweb.hgweb(b'.', name=b'repo')) > > output = stringio() > env['PATH_INFO'] = '/file/tip/' > env['QUERY_STRING'] = 'style=raw' - > process(hgweb.hgweb(b'.', name = b'repo')) + > process(hgweb.hgweb(b'.', name=b'repo')) > > output = stringio() > env['PATH_INFO'] = '/' diff --git a/tests/test-import-context.t b/tests/test-import-context.t --- a/tests/test-import-context.t +++ b/tests/test-import-context.t @@ -12,9 +12,9 @@ Test applying context diffs > count = int(pattern[0:-1]) > char = pattern[-1].encode('utf8') + b'\n' > if not lasteol and i == len(patterns) - 1: - > fp.write((char*count)[:-1]) + > fp.write((char * count)[:-1]) > else: - > fp.write(char*count) + > fp.write(char * count) > fp.close() > EOF $ cat > cat.py < # > # this makes the original largefiles code abort: > _origcopyfileobj = shutil.copyfileobj - > def copyfileobj(fsrc, fdst, length=16*1024): + > def copyfileobj(fsrc, fdst, length=16 * 1024): > # allow journal files (used by transaction) to be written > if b'journal.' in fdst.name: > return _origcopyfileobj(fsrc, fdst, length) diff --git a/tests/test-mq-missingfiles.t b/tests/test-mq-missingfiles.t --- a/tests/test-mq-missingfiles.t +++ b/tests/test-mq-missingfiles.t @@ -15,10 +15,10 @@ future qrefresh. > > f = open(path, 'wb') > for i in range(len(args) // 2): - > count, s = args[2*i:2*i+2] + > count, s = args[2 * i:2 * i + 2] > count = int(count) > s = encode(s) - > f.write(s*count) + > f.write(s * count) > f.close() > EOF diff --git a/tests/test-mq-qimport.t b/tests/test-mq-qimport.t --- a/tests/test-mq-qimport.t +++ b/tests/test-mq-qimport.t @@ -9,11 +9,11 @@ > assert (len(args) % 2) == 0 > > f = open(path, 'wb') - > for i in range(len(args)//2): - > count, s = args[2*i:2*i+2] + > for i in range(len(args) // 2): + > count, s = args[2 * i:2 * i + 2] > count = int(count) > s = encode(s) - > f.write(s*count) + > f.write(s * count) > f.close() > > EOF diff --git a/tests/test-patch-offset.t b/tests/test-patch-offset.t --- a/tests/test-patch-offset.t +++ b/tests/test-patch-offset.t @@ -9,7 +9,7 @@ > for pattern in patterns: > count = int(pattern[0:-1]) > char = pattern[-1].encode('utf8') + b'\n' - > fp.write(char*count) + > fp.write(char * count) > fp.close() > EOF diff --git a/tests/test-purge.t b/tests/test-purge.t --- a/tests/test-purge.t +++ b/tests/test-purge.t @@ -52,7 +52,7 @@ delete an untracked file $ "$PYTHON" < import os > import stat - > f= 'untracked_file_readonly' + > f = 'untracked_file_readonly' > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE) > EOF $ hg purge -p diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -12,9 +12,9 @@ > """ > if 3 not in subset: > if 2 in subset: - > return baseset([2,2]) + > return baseset([2, 2]) > return baseset() - > return baseset([3,3,2,2]) + > return baseset([3, 3, 2, 2]) > > mercurial.revset.symbols[b'r3232'] = r3232 > EOF