##// END OF EJS Templates
py3: add b'' prefixes in tests/test-ui-config.py...
Pulkit Goyal -
r37537:3740d1ab default
parent child Browse files
Show More
@@ -12,111 +12,111 b' testui = uimod.ui.load()'
12 # the purpose of this test is to check the old behavior, not to validate the
12 # the purpose of this test is to check the old behavior, not to validate the
13 # behavior from registered item. so we silent warning related to unregisted
13 # behavior from registered item. so we silent warning related to unregisted
14 # config.
14 # config.
15 testui.setconfig('devel', 'warn-config-unknown', False, 'test')
15 testui.setconfig(b'devel', b'warn-config-unknown', False, b'test')
16 testui.setconfig('devel', 'all-warnings', False, 'test')
16 testui.setconfig(b'devel', b'all-warnings', False, b'test')
17
17
18 parsed = dispatch._parseconfig(testui, [
18 parsed = dispatch._parseconfig(testui, [
19 'values.string=string value',
19 b'values.string=string value',
20 'values.bool1=true',
20 b'values.bool1=true',
21 'values.bool2=false',
21 b'values.bool2=false',
22 'values.boolinvalid=foo',
22 b'values.boolinvalid=foo',
23 'values.int1=42',
23 b'values.int1=42',
24 'values.int2=-42',
24 b'values.int2=-42',
25 'values.intinvalid=foo',
25 b'values.intinvalid=foo',
26 'lists.list1=foo',
26 b'lists.list1=foo',
27 'lists.list2=foo bar baz',
27 b'lists.list2=foo bar baz',
28 'lists.list3=alice, bob',
28 b'lists.list3=alice, bob',
29 'lists.list4=foo bar baz alice, bob',
29 b'lists.list4=foo bar baz alice, bob',
30 'lists.list5=abc d"ef"g "hij def"',
30 b'lists.list5=abc d"ef"g "hij def"',
31 'lists.list6="hello world", "how are you?"',
31 b'lists.list6="hello world", "how are you?"',
32 'lists.list7=Do"Not"Separate',
32 b'lists.list7=Do"Not"Separate',
33 'lists.list8="Do"Separate',
33 b'lists.list8="Do"Separate',
34 'lists.list9="Do\\"NotSeparate"',
34 b'lists.list9="Do\\"NotSeparate"',
35 'lists.list10=string "with extraneous" quotation mark"',
35 b'lists.list10=string "with extraneous" quotation mark"',
36 'lists.list11=x, y',
36 b'lists.list11=x, y',
37 'lists.list12="x", "y"',
37 b'lists.list12="x", "y"',
38 'lists.list13=""" key = "x", "y" """',
38 b'lists.list13=""" key = "x", "y" """',
39 'lists.list14=,,,, ',
39 b'lists.list14=,,,, ',
40 'lists.list15=" just with starting quotation',
40 b'lists.list15=" just with starting quotation',
41 'lists.list16="longer quotation" with "no ending quotation',
41 b'lists.list16="longer quotation" with "no ending quotation',
42 'lists.list17=this is \\" "not a quotation mark"',
42 b'lists.list17=this is \\" "not a quotation mark"',
43 'lists.list18=\n \n\nding\ndong',
43 b'lists.list18=\n \n\nding\ndong',
44 'date.epoch=0 0',
44 b'date.epoch=0 0',
45 'date.birth=2005-04-19T00:00:00',
45 b'date.birth=2005-04-19T00:00:00',
46 'date.invalid=0'
46 b'date.invalid=0'
47 ])
47 ])
48
48
49 print(repr(testui.configitems('values')))
49 print(repr(testui.configitems(b'values')))
50 print(repr(testui.configitems('lists')))
50 print(repr(testui.configitems(b'lists')))
51 print("---")
51 print("---")
52 print(repr(testui.config('values', 'string')))
52 print(repr(testui.config(b'values', b'string')))
53 print(repr(testui.config('values', 'bool1')))
53 print(repr(testui.config(b'values', b'bool1')))
54 print(repr(testui.config('values', 'bool2')))
54 print(repr(testui.config(b'values', b'bool2')))
55 print(repr(testui.config('values', 'unknown')))
55 print(repr(testui.config(b'values', b'unknown')))
56 print("---")
56 print("---")
57 try:
57 try:
58 print(repr(testui.configbool('values', 'string')))
58 print(repr(testui.configbool(b'values', b'string')))
59 except error.ConfigError as inst:
59 except error.ConfigError as inst:
60 print(inst)
60 print(inst)
61 print(repr(testui.configbool('values', 'bool1')))
61 print(repr(testui.configbool(b'values', b'bool1')))
62 print(repr(testui.configbool('values', 'bool2')))
62 print(repr(testui.configbool(b'values', b'bool2')))
63 print(repr(testui.configbool('values', 'bool2', True)))
63 print(repr(testui.configbool(b'values', b'bool2', True)))
64 print(repr(testui.configbool('values', 'unknown')))
64 print(repr(testui.configbool(b'values', b'unknown')))
65 print(repr(testui.configbool('values', 'unknown', True)))
65 print(repr(testui.configbool(b'values', b'unknown', True)))
66 print("---")
66 print("---")
67 print(repr(testui.configint('values', 'int1')))
67 print(repr(testui.configint(b'values', b'int1')))
68 print(repr(testui.configint('values', 'int2')))
68 print(repr(testui.configint(b'values', b'int2')))
69 print("---")
69 print("---")
70 print(repr(testui.configlist('lists', 'list1')))
70 print(repr(testui.configlist(b'lists', b'list1')))
71 print(repr(testui.configlist('lists', 'list2')))
71 print(repr(testui.configlist(b'lists', b'list2')))
72 print(repr(testui.configlist('lists', 'list3')))
72 print(repr(testui.configlist(b'lists', b'list3')))
73 print(repr(testui.configlist('lists', 'list4')))
73 print(repr(testui.configlist(b'lists', b'list4')))
74 print(repr(testui.configlist('lists', 'list4', ['foo'])))
74 print(repr(testui.configlist(b'lists', b'list4', [b'foo'])))
75 print(repr(testui.configlist('lists', 'list5')))
75 print(repr(testui.configlist(b'lists', b'list5')))
76 print(repr(testui.configlist('lists', 'list6')))
76 print(repr(testui.configlist(b'lists', b'list6')))
77 print(repr(testui.configlist('lists', 'list7')))
77 print(repr(testui.configlist(b'lists', b'list7')))
78 print(repr(testui.configlist('lists', 'list8')))
78 print(repr(testui.configlist(b'lists', b'list8')))
79 print(repr(testui.configlist('lists', 'list9')))
79 print(repr(testui.configlist(b'lists', b'list9')))
80 print(repr(testui.configlist('lists', 'list10')))
80 print(repr(testui.configlist(b'lists', b'list10')))
81 print(repr(testui.configlist('lists', 'list11')))
81 print(repr(testui.configlist(b'lists', b'list11')))
82 print(repr(testui.configlist('lists', 'list12')))
82 print(repr(testui.configlist(b'lists', b'list12')))
83 print(repr(testui.configlist('lists', 'list13')))
83 print(repr(testui.configlist(b'lists', b'list13')))
84 print(repr(testui.configlist('lists', 'list14')))
84 print(repr(testui.configlist(b'lists', b'list14')))
85 print(repr(testui.configlist('lists', 'list15')))
85 print(repr(testui.configlist(b'lists', b'list15')))
86 print(repr(testui.configlist('lists', 'list16')))
86 print(repr(testui.configlist(b'lists', b'list16')))
87 print(repr(testui.configlist('lists', 'list17')))
87 print(repr(testui.configlist(b'lists', b'list17')))
88 print(repr(testui.configlist('lists', 'list18')))
88 print(repr(testui.configlist(b'lists', b'list18')))
89 print(repr(testui.configlist('lists', 'unknown')))
89 print(repr(testui.configlist(b'lists', b'unknown')))
90 print(repr(testui.configlist('lists', 'unknown', '')))
90 print(repr(testui.configlist(b'lists', b'unknown', b'')))
91 print(repr(testui.configlist('lists', 'unknown', 'foo')))
91 print(repr(testui.configlist(b'lists', b'unknown', b'foo')))
92 print(repr(testui.configlist('lists', 'unknown', ['foo'])))
92 print(repr(testui.configlist(b'lists', b'unknown', [b'foo'])))
93 print(repr(testui.configlist('lists', 'unknown', 'foo bar')))
93 print(repr(testui.configlist(b'lists', b'unknown', b'foo bar')))
94 print(repr(testui.configlist('lists', 'unknown', 'foo, bar')))
94 print(repr(testui.configlist(b'lists', b'unknown', b'foo, bar')))
95 print(repr(testui.configlist('lists', 'unknown', ['foo bar'])))
95 print(repr(testui.configlist(b'lists', b'unknown', [b'foo bar'])))
96 print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])))
96 print(repr(testui.configlist(b'lists', b'unknown', [b'foo', b'bar'])))
97 print("---")
97 print("---")
98 print(repr(testui.configdate('date', 'epoch')))
98 print(repr(testui.configdate(b'date', b'epoch')))
99 print(repr(testui.configdate('date', 'birth')))
99 print(repr(testui.configdate(b'date', b'birth')))
100
100
101 print(repr(testui.config('values', 'String')))
101 print(repr(testui.config(b'values', b'String')))
102
102
103 def function():
103 def function():
104 pass
104 pass
105
105
106 # values that aren't strings should work
106 # values that aren't strings should work
107 testui.setconfig('hook', 'commit', function)
107 testui.setconfig(b'hook', b'commit', function)
108 print(function == testui.config('hook', 'commit'))
108 print(function == testui.config(b'hook', b'commit'))
109
109
110 # invalid values
110 # invalid values
111 try:
111 try:
112 testui.configbool('values', 'boolinvalid')
112 testui.configbool(b'values', b'boolinvalid')
113 except error.ConfigError:
113 except error.ConfigError:
114 print('boolinvalid')
114 print('boolinvalid')
115 try:
115 try:
116 testui.configint('values', 'intinvalid')
116 testui.configint(b'values', b'intinvalid')
117 except error.ConfigError:
117 except error.ConfigError:
118 print('intinvalid')
118 print('intinvalid')
119 try:
119 try:
120 testui.configdate('date', 'invalid')
120 testui.configdate(b'date', b'invalid')
121 except error.ConfigError:
121 except error.ConfigError:
122 print('dateinvalid')
122 print('dateinvalid')
General Comments 0
You need to be logged in to leave comments. Login now