changeset 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 2e5be704bc96
files tests/test-check-py3-compat.t tests/test-ui-config.py
diffstat 2 files changed, 51 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-check-py3-compat.t	Tue Mar 29 16:33:09 2016 +0530
+++ b/tests/test-check-py3-compat.t	Tue Mar 29 16:38:27 2016 +0530
@@ -109,7 +109,6 @@
   tests/test-trusted.py requires print_function
   tests/test-ui-color.py not using absolute_import
   tests/test-ui-color.py requires print_function
-  tests/test-ui-config.py requires print_function
   tests/test-url.py not using absolute_import
 
 #if py3exe
@@ -292,6 +291,5 @@
   tests/test-status-inprocess.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-ui-color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  tests/test-ui-config.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
 
 #endif
--- a/tests/test-ui-config.py	Tue Mar 29 16:33:09 2016 +0530
+++ b/tests/test-ui-config.py	Tue Mar 29 16:38:27 2016 +0530
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 from mercurial import (
     dispatch,
     error,
@@ -34,70 +34,70 @@
     'lists.list18=\n \n\nding\ndong',
     ])
 
-print repr(testui.configitems('values'))
-print repr(testui.configitems('lists'))
-print "---"
-print repr(testui.config('values', 'string'))
-print repr(testui.config('values', 'bool1'))
-print repr(testui.config('values', 'bool2'))
-print repr(testui.config('values', 'unknown'))
-print "---"
+print(repr(testui.configitems('values')))
+print(repr(testui.configitems('lists')))
+print("---")
+print(repr(testui.config('values', 'string')))
+print(repr(testui.config('values', 'bool1')))
+print(repr(testui.config('values', 'bool2')))
+print(repr(testui.config('values', 'unknown')))
+print("---")
 try:
-    print repr(testui.configbool('values', 'string'))
+    print(repr(testui.configbool('values', 'string')))
 except error.ConfigError as inst:
-    print inst
-print repr(testui.configbool('values', 'bool1'))
-print repr(testui.configbool('values', 'bool2'))
-print repr(testui.configbool('values', 'bool2', True))
-print repr(testui.configbool('values', 'unknown'))
-print repr(testui.configbool('values', 'unknown', True))
-print "---"
-print repr(testui.configint('values', 'int1'))
-print repr(testui.configint('values', 'int2'))
-print "---"
-print repr(testui.configlist('lists', 'list1'))
-print repr(testui.configlist('lists', 'list2'))
-print repr(testui.configlist('lists', 'list3'))
-print repr(testui.configlist('lists', 'list4'))
-print repr(testui.configlist('lists', 'list4', ['foo']))
-print repr(testui.configlist('lists', 'list5'))
-print repr(testui.configlist('lists', 'list6'))
-print repr(testui.configlist('lists', 'list7'))
-print repr(testui.configlist('lists', 'list8'))
-print repr(testui.configlist('lists', 'list9'))
-print repr(testui.configlist('lists', 'list10'))
-print repr(testui.configlist('lists', 'list11'))
-print repr(testui.configlist('lists', 'list12'))
-print repr(testui.configlist('lists', 'list13'))
-print repr(testui.configlist('lists', 'list14'))
-print repr(testui.configlist('lists', 'list15'))
-print repr(testui.configlist('lists', 'list16'))
-print repr(testui.configlist('lists', 'list17'))
-print repr(testui.configlist('lists', 'list18'))
-print repr(testui.configlist('lists', 'unknown'))
-print repr(testui.configlist('lists', 'unknown', ''))
-print repr(testui.configlist('lists', 'unknown', 'foo'))
-print repr(testui.configlist('lists', 'unknown', ['foo']))
-print repr(testui.configlist('lists', 'unknown', 'foo bar'))
-print repr(testui.configlist('lists', 'unknown', 'foo, bar'))
-print repr(testui.configlist('lists', 'unknown', ['foo bar']))
-print repr(testui.configlist('lists', 'unknown', ['foo', 'bar']))
+    print(inst)
+print(repr(testui.configbool('values', 'bool1')))
+print(repr(testui.configbool('values', 'bool2')))
+print(repr(testui.configbool('values', 'bool2', True)))
+print(repr(testui.configbool('values', 'unknown')))
+print(repr(testui.configbool('values', 'unknown', True)))
+print("---")
+print(repr(testui.configint('values', 'int1')))
+print(repr(testui.configint('values', 'int2')))
+print("---")
+print(repr(testui.configlist('lists', 'list1')))
+print(repr(testui.configlist('lists', 'list2')))
+print(repr(testui.configlist('lists', 'list3')))
+print(repr(testui.configlist('lists', 'list4')))
+print(repr(testui.configlist('lists', 'list4', ['foo'])))
+print(repr(testui.configlist('lists', 'list5')))
+print(repr(testui.configlist('lists', 'list6')))
+print(repr(testui.configlist('lists', 'list7')))
+print(repr(testui.configlist('lists', 'list8')))
+print(repr(testui.configlist('lists', 'list9')))
+print(repr(testui.configlist('lists', 'list10')))
+print(repr(testui.configlist('lists', 'list11')))
+print(repr(testui.configlist('lists', 'list12')))
+print(repr(testui.configlist('lists', 'list13')))
+print(repr(testui.configlist('lists', 'list14')))
+print(repr(testui.configlist('lists', 'list15')))
+print(repr(testui.configlist('lists', 'list16')))
+print(repr(testui.configlist('lists', 'list17')))
+print(repr(testui.configlist('lists', 'list18')))
+print(repr(testui.configlist('lists', 'unknown')))
+print(repr(testui.configlist('lists', 'unknown', '')))
+print(repr(testui.configlist('lists', 'unknown', 'foo')))
+print(repr(testui.configlist('lists', 'unknown', ['foo'])))
+print(repr(testui.configlist('lists', 'unknown', 'foo bar')))
+print(repr(testui.configlist('lists', 'unknown', 'foo, bar')))
+print(repr(testui.configlist('lists', 'unknown', ['foo bar'])))
+print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])))
 
-print repr(testui.config('values', 'String'))
+print(repr(testui.config('values', 'String')))
 
 def function():
     pass
 
 # values that aren't strings should work
 testui.setconfig('hook', 'commit', function)
-print function == testui.config('hook', 'commit')
+print(function == testui.config('hook', 'commit'))
 
 # invalid values
 try:
     testui.configbool('values', 'boolinvalid')
 except error.ConfigError:
-    print 'boolinvalid'
+    print('boolinvalid')
 try:
     testui.configint('values', 'intinvalid')
 except error.ConfigError:
-    print 'intinvalid'
+    print('intinvalid')