Mercurial > hg-stable
changeset 37981:a2cfea193040
tests: port test-ui-config to Python 3
Slight test output changes to make life easier.
Differential Revision: https://phab.mercurial-scm.org/D3526
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 13:15:51 -0400 |
parents | 48378d0e9479 |
children | ac865f020b99 |
files | contrib/python3-whitelist tests/test-ui-config.py tests/test-ui-config.py.out |
diffstat | 3 files changed, 54 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/python3-whitelist Fri Apr 27 13:37:10 2018 -0400 +++ b/contrib/python3-whitelist Fri Apr 27 13:15:51 2018 -0400 @@ -454,6 +454,7 @@ test-template-engine.t test-treemanifest.t test-ui-color.py +test-ui-config.py test-ui-verbosity.py test-unamend.t test-uncommit.t
--- a/tests/test-ui-config.py Fri Apr 27 13:37:10 2018 -0400 +++ b/tests/test-ui-config.py Fri Apr 27 13:15:51 2018 -0400 @@ -2,8 +2,12 @@ from mercurial import ( dispatch, error, + pycompat, ui as uimod, ) +from mercurial.utils import ( + stringutil, +) testui = uimod.ui.load() @@ -46,59 +50,62 @@ b'date.invalid=0' ]) -print(repr(testui.configitems(b'values'))) -print(repr(testui.configitems(b'lists'))) +def pprint(obj): + return stringutil.pprint(obj, bprefix=False).decode('ascii') + +print(pprint(testui.configitems(b'values'))) +print(pprint(testui.configitems(b'lists'))) print("---") -print(repr(testui.config(b'values', b'string'))) -print(repr(testui.config(b'values', b'bool1'))) -print(repr(testui.config(b'values', b'bool2'))) -print(repr(testui.config(b'values', b'unknown'))) +print(pprint(testui.config(b'values', b'string'))) +print(pprint(testui.config(b'values', b'bool1'))) +print(pprint(testui.config(b'values', b'bool2'))) +print(pprint(testui.config(b'values', b'unknown'))) print("---") try: - print(repr(testui.configbool(b'values', b'string'))) + print(pprint(testui.configbool(b'values', b'string'))) except error.ConfigError as inst: - print(inst) -print(repr(testui.configbool(b'values', b'bool1'))) -print(repr(testui.configbool(b'values', b'bool2'))) -print(repr(testui.configbool(b'values', b'bool2', True))) -print(repr(testui.configbool(b'values', b'unknown'))) -print(repr(testui.configbool(b'values', b'unknown', True))) + print(pprint(pycompat.bytestr(inst))) +print(pprint(testui.configbool(b'values', b'bool1'))) +print(pprint(testui.configbool(b'values', b'bool2'))) +print(pprint(testui.configbool(b'values', b'bool2', True))) +print(pprint(testui.configbool(b'values', b'unknown'))) +print(pprint(testui.configbool(b'values', b'unknown', True))) print("---") -print(repr(testui.configint(b'values', b'int1'))) -print(repr(testui.configint(b'values', b'int2'))) +print(pprint(testui.configint(b'values', b'int1'))) +print(pprint(testui.configint(b'values', b'int2'))) print("---") -print(repr(testui.configlist(b'lists', b'list1'))) -print(repr(testui.configlist(b'lists', b'list2'))) -print(repr(testui.configlist(b'lists', b'list3'))) -print(repr(testui.configlist(b'lists', b'list4'))) -print(repr(testui.configlist(b'lists', b'list4', [b'foo']))) -print(repr(testui.configlist(b'lists', b'list5'))) -print(repr(testui.configlist(b'lists', b'list6'))) -print(repr(testui.configlist(b'lists', b'list7'))) -print(repr(testui.configlist(b'lists', b'list8'))) -print(repr(testui.configlist(b'lists', b'list9'))) -print(repr(testui.configlist(b'lists', b'list10'))) -print(repr(testui.configlist(b'lists', b'list11'))) -print(repr(testui.configlist(b'lists', b'list12'))) -print(repr(testui.configlist(b'lists', b'list13'))) -print(repr(testui.configlist(b'lists', b'list14'))) -print(repr(testui.configlist(b'lists', b'list15'))) -print(repr(testui.configlist(b'lists', b'list16'))) -print(repr(testui.configlist(b'lists', b'list17'))) -print(repr(testui.configlist(b'lists', b'list18'))) -print(repr(testui.configlist(b'lists', b'unknown'))) -print(repr(testui.configlist(b'lists', b'unknown', b''))) -print(repr(testui.configlist(b'lists', b'unknown', b'foo'))) -print(repr(testui.configlist(b'lists', b'unknown', [b'foo']))) -print(repr(testui.configlist(b'lists', b'unknown', b'foo bar'))) -print(repr(testui.configlist(b'lists', b'unknown', b'foo, bar'))) -print(repr(testui.configlist(b'lists', b'unknown', [b'foo bar']))) -print(repr(testui.configlist(b'lists', b'unknown', [b'foo', b'bar']))) +print(pprint(testui.configlist(b'lists', b'list1'))) +print(pprint(testui.configlist(b'lists', b'list2'))) +print(pprint(testui.configlist(b'lists', b'list3'))) +print(pprint(testui.configlist(b'lists', b'list4'))) +print(pprint(testui.configlist(b'lists', b'list4', [b'foo']))) +print(pprint(testui.configlist(b'lists', b'list5'))) +print(pprint(testui.configlist(b'lists', b'list6'))) +print(pprint(testui.configlist(b'lists', b'list7'))) +print(pprint(testui.configlist(b'lists', b'list8'))) +print(pprint(testui.configlist(b'lists', b'list9'))) +print(pprint(testui.configlist(b'lists', b'list10'))) +print(pprint(testui.configlist(b'lists', b'list11'))) +print(pprint(testui.configlist(b'lists', b'list12'))) +print(pprint(testui.configlist(b'lists', b'list13'))) +print(pprint(testui.configlist(b'lists', b'list14'))) +print(pprint(testui.configlist(b'lists', b'list15'))) +print(pprint(testui.configlist(b'lists', b'list16'))) +print(pprint(testui.configlist(b'lists', b'list17'))) +print(pprint(testui.configlist(b'lists', b'list18'))) +print(pprint(testui.configlist(b'lists', b'unknown'))) +print(pprint(testui.configlist(b'lists', b'unknown', b''))) +print(pprint(testui.configlist(b'lists', b'unknown', b'foo'))) +print(pprint(testui.configlist(b'lists', b'unknown', [b'foo']))) +print(pprint(testui.configlist(b'lists', b'unknown', b'foo bar'))) +print(pprint(testui.configlist(b'lists', b'unknown', b'foo, bar'))) +print(pprint(testui.configlist(b'lists', b'unknown', [b'foo bar']))) +print(pprint(testui.configlist(b'lists', b'unknown', [b'foo', b'bar']))) print("---") -print(repr(testui.configdate(b'date', b'epoch'))) -print(repr(testui.configdate(b'date', b'birth'))) +print(pprint(testui.configdate(b'date', b'epoch'))) +print(pprint(testui.configdate(b'date', b'birth'))) -print(repr(testui.config(b'values', b'String'))) +print(pprint(testui.config(b'values', b'String'))) def function(): pass