Mercurial > hg
comparison mercurial/templater.py @ 34139:be00af4a1ac5
doctest: coerce dict.keys() to list
Otherwise it would be printed as odict_keys([...]) on Python 3.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 03 Sep 2017 17:33:10 +0900 |
parents | a8994d08e4a2 |
children | 448725a2ef73 |
comparison
equal
deleted
inserted
replaced
34138:0f9936d80e01 | 34139:be00af4a1ac5 |
---|---|
487 >>> context = engine(lambda t: (runsymbol, t)) | 487 >>> context = engine(lambda t: (runsymbol, t)) |
488 >>> def fargs(expr, argspec): | 488 >>> def fargs(expr, argspec): |
489 ... x = _parseexpr(expr) | 489 ... x = _parseexpr(expr) |
490 ... n = getsymbol(x[1]) | 490 ... n = getsymbol(x[1]) |
491 ... return _buildfuncargs(x[2], context, exprmethods, n, argspec) | 491 ... return _buildfuncargs(x[2], context, exprmethods, n, argspec) |
492 >>> fargs(b'a(l=1, k=2)', b'k l m').keys() | 492 >>> list(fargs(b'a(l=1, k=2)', b'k l m').keys()) |
493 ['l', 'k'] | 493 ['l', 'k'] |
494 >>> args = fargs(b'a(opts=1, k=2)', b'**opts') | 494 >>> args = fargs(b'a(opts=1, k=2)', b'**opts') |
495 >>> args.keys(), args[b'opts'].keys() | 495 >>> list(args.keys()), list(args[b'opts'].keys()) |
496 (['opts'], ['opts', 'k']) | 496 (['opts'], ['opts', 'k']) |
497 """ | 497 """ |
498 def compiledict(xs): | 498 def compiledict(xs): |
499 return util.sortdict((k, compileexp(x, context, curmethods)) | 499 return util.sortdict((k, compileexp(x, context, curmethods)) |
500 for k, x in xs.iteritems()) | 500 for k, x in xs.iteritems()) |