Mercurial > public > mercurial-scm > hg-stable
diff tests/test-batching.py @ 45957:89a2afe31e82
formating: upgrade to black 20.8b1
This required a couple of small tweaks to un-confuse black, but now it
works. Big formatting changes come from:
* Dramatically improved collection-splitting logic upstream
* Black having a strong (correct IMO) opinion that """ is better than '''
Differential Revision: https://phab.mercurial-scm.org/D9430
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 27 Nov 2020 17:03:29 -0500 |
parents | 2372284d9457 |
children | 05dd091dfa6a |
line wrap: on
line diff
--- a/tests/test-batching.py Fri Nov 27 17:00:00 2020 -0500 +++ b/tests/test-batching.py Fri Nov 27 17:03:29 2020 -0500 @@ -30,11 +30,17 @@ class localthing(thing): def foo(self, one, two=None): if one: - return b"%s and %s" % (one, two,) + return b"%s and %s" % ( + one, + two, + ) return b"Nope" def bar(self, b, a): - return b"%s und %s" % (b, a,) + return b"%s und %s" % ( + b, + a, + ) def greet(self, name=None): return b"Hello, %s" % name @@ -176,7 +182,15 @@ args = b','.join(n + b'=' + escapearg(v) for n, v in args) req.append(name + b':' + args) req = b';'.join(req) - res = self._submitone(b'batch', [(b'cmds', req,)]) + res = self._submitone( + b'batch', + [ + ( + b'cmds', + req, + ) + ], + ) for r in res.split(b';'): yield r @@ -190,7 +204,16 @@ @wireprotov1peer.batchable def foo(self, one, two=None): - encargs = [(b'one', mangle(one),), (b'two', mangle(two),)] + encargs = [ + ( + b'one', + mangle(one), + ), + ( + b'two', + mangle(two), + ), + ] encresref = wireprotov1peer.future() yield encargs, encresref yield unmangle(encresref.value) @@ -198,14 +221,33 @@ @wireprotov1peer.batchable def bar(self, b, a): encresref = wireprotov1peer.future() - yield [(b'b', mangle(b),), (b'a', mangle(a),)], encresref + yield [ + ( + b'b', + mangle(b), + ), + ( + b'a', + mangle(a), + ), + ], encresref yield unmangle(encresref.value) # greet is coded directly. It therefore does not support batching. If it # does appear in a batch, the batch is split around greet, and the call to # greet is done in its own roundtrip. def greet(self, name=None): - return unmangle(self._submitone(b'greet', [(b'name', mangle(name),)])) + return unmangle( + self._submitone( + b'greet', + [ + ( + b'name', + mangle(name), + ) + ], + ) + ) # demo remote usage