Mercurial > public > mercurial-scm > hg-stable
diff tests/test-minirst.py @ 39337:a2a5d4ad5276
minirst: make format() simply return a formatted text
It's a source of bugs to change the type of the return value conditionally.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 05 Aug 2018 12:11:19 +0900 |
parents | 32bc3815efae |
children | 2372284d9457 |
line wrap: on
line diff
--- a/tests/test-minirst.py Sun Aug 05 12:20:43 2018 +0900 +++ b/tests/test-minirst.py Sun Aug 05 12:11:19 2018 +0900 @@ -7,6 +7,7 @@ ) def debugformat(text, form, **kwargs): + blocks, pruned = minirst.parse(text, **kwargs) if form == b'html': print("html format:") out = minirst.format(text, style=form, **kwargs) @@ -15,12 +16,10 @@ out = minirst.format(text, width=form, **kwargs) print("-" * 70) - if type(out) == tuple: - print(out[0][:-1].decode('utf8')) + print(out[:-1].decode('utf8')) + if kwargs.get('keep'): print("-" * 70) - print(stringutil.pprint(out[1]).decode('utf8')) - else: - print(out[:-1].decode('utf8')) + print(stringutil.pprint(pruned).decode('utf8')) print("-" * 70) print()