Mercurial > hg
comparison tests/test-ui-config.py @ 28681:eda8b28e3b1b
py3: make test-ui-config use print_function
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 16:38:27 +0530 |
parents | ae606bdedc3e |
children | 5508a277bab2 |
comparison
equal
deleted
inserted
replaced
28680:ae606bdedc3e | 28681:eda8b28e3b1b |
---|---|
1 from __future__ import absolute_import | 1 from __future__ import absolute_import, print_function |
2 from mercurial import ( | 2 from mercurial import ( |
3 dispatch, | 3 dispatch, |
4 error, | 4 error, |
5 ui, | 5 ui, |
6 ) | 6 ) |
32 'lists.list16="longer quotation" with "no ending quotation', | 32 'lists.list16="longer quotation" with "no ending quotation', |
33 'lists.list17=this is \\" "not a quotation mark"', | 33 'lists.list17=this is \\" "not a quotation mark"', |
34 'lists.list18=\n \n\nding\ndong', | 34 'lists.list18=\n \n\nding\ndong', |
35 ]) | 35 ]) |
36 | 36 |
37 print repr(testui.configitems('values')) | 37 print(repr(testui.configitems('values'))) |
38 print repr(testui.configitems('lists')) | 38 print(repr(testui.configitems('lists'))) |
39 print "---" | 39 print("---") |
40 print repr(testui.config('values', 'string')) | 40 print(repr(testui.config('values', 'string'))) |
41 print repr(testui.config('values', 'bool1')) | 41 print(repr(testui.config('values', 'bool1'))) |
42 print repr(testui.config('values', 'bool2')) | 42 print(repr(testui.config('values', 'bool2'))) |
43 print repr(testui.config('values', 'unknown')) | 43 print(repr(testui.config('values', 'unknown'))) |
44 print "---" | 44 print("---") |
45 try: | 45 try: |
46 print repr(testui.configbool('values', 'string')) | 46 print(repr(testui.configbool('values', 'string'))) |
47 except error.ConfigError as inst: | 47 except error.ConfigError as inst: |
48 print inst | 48 print(inst) |
49 print repr(testui.configbool('values', 'bool1')) | 49 print(repr(testui.configbool('values', 'bool1'))) |
50 print repr(testui.configbool('values', 'bool2')) | 50 print(repr(testui.configbool('values', 'bool2'))) |
51 print repr(testui.configbool('values', 'bool2', True)) | 51 print(repr(testui.configbool('values', 'bool2', True))) |
52 print repr(testui.configbool('values', 'unknown')) | 52 print(repr(testui.configbool('values', 'unknown'))) |
53 print repr(testui.configbool('values', 'unknown', True)) | 53 print(repr(testui.configbool('values', 'unknown', True))) |
54 print "---" | 54 print("---") |
55 print repr(testui.configint('values', 'int1')) | 55 print(repr(testui.configint('values', 'int1'))) |
56 print repr(testui.configint('values', 'int2')) | 56 print(repr(testui.configint('values', 'int2'))) |
57 print "---" | 57 print("---") |
58 print repr(testui.configlist('lists', 'list1')) | 58 print(repr(testui.configlist('lists', 'list1'))) |
59 print repr(testui.configlist('lists', 'list2')) | 59 print(repr(testui.configlist('lists', 'list2'))) |
60 print repr(testui.configlist('lists', 'list3')) | 60 print(repr(testui.configlist('lists', 'list3'))) |
61 print repr(testui.configlist('lists', 'list4')) | 61 print(repr(testui.configlist('lists', 'list4'))) |
62 print repr(testui.configlist('lists', 'list4', ['foo'])) | 62 print(repr(testui.configlist('lists', 'list4', ['foo']))) |
63 print repr(testui.configlist('lists', 'list5')) | 63 print(repr(testui.configlist('lists', 'list5'))) |
64 print repr(testui.configlist('lists', 'list6')) | 64 print(repr(testui.configlist('lists', 'list6'))) |
65 print repr(testui.configlist('lists', 'list7')) | 65 print(repr(testui.configlist('lists', 'list7'))) |
66 print repr(testui.configlist('lists', 'list8')) | 66 print(repr(testui.configlist('lists', 'list8'))) |
67 print repr(testui.configlist('lists', 'list9')) | 67 print(repr(testui.configlist('lists', 'list9'))) |
68 print repr(testui.configlist('lists', 'list10')) | 68 print(repr(testui.configlist('lists', 'list10'))) |
69 print repr(testui.configlist('lists', 'list11')) | 69 print(repr(testui.configlist('lists', 'list11'))) |
70 print repr(testui.configlist('lists', 'list12')) | 70 print(repr(testui.configlist('lists', 'list12'))) |
71 print repr(testui.configlist('lists', 'list13')) | 71 print(repr(testui.configlist('lists', 'list13'))) |
72 print repr(testui.configlist('lists', 'list14')) | 72 print(repr(testui.configlist('lists', 'list14'))) |
73 print repr(testui.configlist('lists', 'list15')) | 73 print(repr(testui.configlist('lists', 'list15'))) |
74 print repr(testui.configlist('lists', 'list16')) | 74 print(repr(testui.configlist('lists', 'list16'))) |
75 print repr(testui.configlist('lists', 'list17')) | 75 print(repr(testui.configlist('lists', 'list17'))) |
76 print repr(testui.configlist('lists', 'list18')) | 76 print(repr(testui.configlist('lists', 'list18'))) |
77 print repr(testui.configlist('lists', 'unknown')) | 77 print(repr(testui.configlist('lists', 'unknown'))) |
78 print repr(testui.configlist('lists', 'unknown', '')) | 78 print(repr(testui.configlist('lists', 'unknown', ''))) |
79 print repr(testui.configlist('lists', 'unknown', 'foo')) | 79 print(repr(testui.configlist('lists', 'unknown', 'foo'))) |
80 print repr(testui.configlist('lists', 'unknown', ['foo'])) | 80 print(repr(testui.configlist('lists', 'unknown', ['foo']))) |
81 print repr(testui.configlist('lists', 'unknown', 'foo bar')) | 81 print(repr(testui.configlist('lists', 'unknown', 'foo bar'))) |
82 print repr(testui.configlist('lists', 'unknown', 'foo, bar')) | 82 print(repr(testui.configlist('lists', 'unknown', 'foo, bar'))) |
83 print repr(testui.configlist('lists', 'unknown', ['foo bar'])) | 83 print(repr(testui.configlist('lists', 'unknown', ['foo bar']))) |
84 print repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])) | 84 print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar']))) |
85 | 85 |
86 print repr(testui.config('values', 'String')) | 86 print(repr(testui.config('values', 'String'))) |
87 | 87 |
88 def function(): | 88 def function(): |
89 pass | 89 pass |
90 | 90 |
91 # values that aren't strings should work | 91 # values that aren't strings should work |
92 testui.setconfig('hook', 'commit', function) | 92 testui.setconfig('hook', 'commit', function) |
93 print function == testui.config('hook', 'commit') | 93 print(function == testui.config('hook', 'commit')) |
94 | 94 |
95 # invalid values | 95 # invalid values |
96 try: | 96 try: |
97 testui.configbool('values', 'boolinvalid') | 97 testui.configbool('values', 'boolinvalid') |
98 except error.ConfigError: | 98 except error.ConfigError: |
99 print 'boolinvalid' | 99 print('boolinvalid') |
100 try: | 100 try: |
101 testui.configint('values', 'intinvalid') | 101 testui.configint('values', 'intinvalid') |
102 except error.ConfigError: | 102 except error.ConfigError: |
103 print 'intinvalid' | 103 print('intinvalid') |