##// END OF EJS Templates
tests: port test-ui-config to Python 3...
Augie Fackler -
r37956:a2cfea19 default
parent child Browse files
Show More
@@ -454,6 +454,7 test-tags.t
454 test-template-engine.t
454 test-template-engine.t
455 test-treemanifest.t
455 test-treemanifest.t
456 test-ui-color.py
456 test-ui-color.py
457 test-ui-config.py
457 test-ui-verbosity.py
458 test-ui-verbosity.py
458 test-unamend.t
459 test-unamend.t
459 test-uncommit.t
460 test-uncommit.t
@@ -2,8 +2,12 from __future__ import absolute_import,
2 from mercurial import (
2 from mercurial import (
3 dispatch,
3 dispatch,
4 error,
4 error,
5 pycompat,
5 ui as uimod,
6 ui as uimod,
6 )
7 )
8 from mercurial.utils import (
9 stringutil,
10 )
7
11
8 testui = uimod.ui.load()
12 testui = uimod.ui.load()
9
13
@@ -46,59 +50,62 parsed = dispatch._parseconfig(testui, [
46 b'date.invalid=0'
50 b'date.invalid=0'
47 ])
51 ])
48
52
49 print(repr(testui.configitems(b'values')))
53 def pprint(obj):
50 print(repr(testui.configitems(b'lists')))
54 return stringutil.pprint(obj, bprefix=False).decode('ascii')
55
56 print(pprint(testui.configitems(b'values')))
57 print(pprint(testui.configitems(b'lists')))
51 print("---")
58 print("---")
52 print(repr(testui.config(b'values', b'string')))
59 print(pprint(testui.config(b'values', b'string')))
53 print(repr(testui.config(b'values', b'bool1')))
60 print(pprint(testui.config(b'values', b'bool1')))
54 print(repr(testui.config(b'values', b'bool2')))
61 print(pprint(testui.config(b'values', b'bool2')))
55 print(repr(testui.config(b'values', b'unknown')))
62 print(pprint(testui.config(b'values', b'unknown')))
56 print("---")
63 print("---")
57 try:
64 try:
58 print(repr(testui.configbool(b'values', b'string')))
65 print(pprint(testui.configbool(b'values', b'string')))
59 except error.ConfigError as inst:
66 except error.ConfigError as inst:
60 print(inst)
67 print(pprint(pycompat.bytestr(inst)))
61 print(repr(testui.configbool(b'values', b'bool1')))
68 print(pprint(testui.configbool(b'values', b'bool1')))
62 print(repr(testui.configbool(b'values', b'bool2')))
69 print(pprint(testui.configbool(b'values', b'bool2')))
63 print(repr(testui.configbool(b'values', b'bool2', True)))
70 print(pprint(testui.configbool(b'values', b'bool2', True)))
64 print(repr(testui.configbool(b'values', b'unknown')))
71 print(pprint(testui.configbool(b'values', b'unknown')))
65 print(repr(testui.configbool(b'values', b'unknown', True)))
72 print(pprint(testui.configbool(b'values', b'unknown', True)))
66 print("---")
73 print("---")
67 print(repr(testui.configint(b'values', b'int1')))
74 print(pprint(testui.configint(b'values', b'int1')))
68 print(repr(testui.configint(b'values', b'int2')))
75 print(pprint(testui.configint(b'values', b'int2')))
69 print("---")
76 print("---")
70 print(repr(testui.configlist(b'lists', b'list1')))
77 print(pprint(testui.configlist(b'lists', b'list1')))
71 print(repr(testui.configlist(b'lists', b'list2')))
78 print(pprint(testui.configlist(b'lists', b'list2')))
72 print(repr(testui.configlist(b'lists', b'list3')))
79 print(pprint(testui.configlist(b'lists', b'list3')))
73 print(repr(testui.configlist(b'lists', b'list4')))
80 print(pprint(testui.configlist(b'lists', b'list4')))
74 print(repr(testui.configlist(b'lists', b'list4', [b'foo'])))
81 print(pprint(testui.configlist(b'lists', b'list4', [b'foo'])))
75 print(repr(testui.configlist(b'lists', b'list5')))
82 print(pprint(testui.configlist(b'lists', b'list5')))
76 print(repr(testui.configlist(b'lists', b'list6')))
83 print(pprint(testui.configlist(b'lists', b'list6')))
77 print(repr(testui.configlist(b'lists', b'list7')))
84 print(pprint(testui.configlist(b'lists', b'list7')))
78 print(repr(testui.configlist(b'lists', b'list8')))
85 print(pprint(testui.configlist(b'lists', b'list8')))
79 print(repr(testui.configlist(b'lists', b'list9')))
86 print(pprint(testui.configlist(b'lists', b'list9')))
80 print(repr(testui.configlist(b'lists', b'list10')))
87 print(pprint(testui.configlist(b'lists', b'list10')))
81 print(repr(testui.configlist(b'lists', b'list11')))
88 print(pprint(testui.configlist(b'lists', b'list11')))
82 print(repr(testui.configlist(b'lists', b'list12')))
89 print(pprint(testui.configlist(b'lists', b'list12')))
83 print(repr(testui.configlist(b'lists', b'list13')))
90 print(pprint(testui.configlist(b'lists', b'list13')))
84 print(repr(testui.configlist(b'lists', b'list14')))
91 print(pprint(testui.configlist(b'lists', b'list14')))
85 print(repr(testui.configlist(b'lists', b'list15')))
92 print(pprint(testui.configlist(b'lists', b'list15')))
86 print(repr(testui.configlist(b'lists', b'list16')))
93 print(pprint(testui.configlist(b'lists', b'list16')))
87 print(repr(testui.configlist(b'lists', b'list17')))
94 print(pprint(testui.configlist(b'lists', b'list17')))
88 print(repr(testui.configlist(b'lists', b'list18')))
95 print(pprint(testui.configlist(b'lists', b'list18')))
89 print(repr(testui.configlist(b'lists', b'unknown')))
96 print(pprint(testui.configlist(b'lists', b'unknown')))
90 print(repr(testui.configlist(b'lists', b'unknown', b'')))
97 print(pprint(testui.configlist(b'lists', b'unknown', b'')))
91 print(repr(testui.configlist(b'lists', b'unknown', b'foo')))
98 print(pprint(testui.configlist(b'lists', b'unknown', b'foo')))
92 print(repr(testui.configlist(b'lists', b'unknown', [b'foo'])))
99 print(pprint(testui.configlist(b'lists', b'unknown', [b'foo'])))
93 print(repr(testui.configlist(b'lists', b'unknown', b'foo bar')))
100 print(pprint(testui.configlist(b'lists', b'unknown', b'foo bar')))
94 print(repr(testui.configlist(b'lists', b'unknown', b'foo, bar')))
101 print(pprint(testui.configlist(b'lists', b'unknown', b'foo, bar')))
95 print(repr(testui.configlist(b'lists', b'unknown', [b'foo bar'])))
102 print(pprint(testui.configlist(b'lists', b'unknown', [b'foo bar'])))
96 print(repr(testui.configlist(b'lists', b'unknown', [b'foo', b'bar'])))
103 print(pprint(testui.configlist(b'lists', b'unknown', [b'foo', b'bar'])))
97 print("---")
104 print("---")
98 print(repr(testui.configdate(b'date', b'epoch')))
105 print(pprint(testui.configdate(b'date', b'epoch')))
99 print(repr(testui.configdate(b'date', b'birth')))
106 print(pprint(testui.configdate(b'date', b'birth')))
100
107
101 print(repr(testui.config(b'values', b'String')))
108 print(pprint(testui.config(b'values', b'String')))
102
109
103 def function():
110 def function():
104 pass
111 pass
@@ -6,7 +6,7
6 'false'
6 'false'
7 None
7 None
8 ---
8 ---
9 values.string is not a boolean ('string value')
9 'values.string is not a boolean (\'string value\')'
10 True
10 True
11 False
11 False
12 False
12 False
General Comments 0
You need to be logged in to leave comments. Login now