summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyril Roelandt <cyril.roelandt@enovance.com>2014-03-18 12:49:27 +0100
committerCyril Roelandt <cyril.roelandt@enovance.com>2014-03-18 12:49:27 +0100
commit9789a96ca9aab44bd71fdcfc5c0bed1ef7cf0838 (patch)
tree543718d130e12237d431dc61a3ce62769ff1c312 /tests
parent4bdb495a250dc8b44309a8d158fb60a8106e3287 (diff)
downloadpaste-9789a96ca9aab44bd71fdcfc5c0bed1ef7cf0838.tar.gz
Python 3: add parenthesis to print() to support Python 2 and Python 3
Use also "from __future__ import print_function".
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cgitb_catcher.py8
-rw-r--r--tests/test_config.py2
-rw-r--r--tests/test_errordocument.py2
-rw-r--r--tests/test_exceptions/test_formatter.py10
-rw-r--r--tests/test_exceptions/test_httpexceptions.py4
-rw-r--r--tests/test_exceptions/test_reporter.py2
-rw-r--r--tests/test_fileapp.py2
-rw-r--r--tests/test_registry.py2
-rw-r--r--tests/test_urlparser.py2
9 files changed, 17 insertions, 17 deletions
diff --git a/tests/test_cgitb_catcher.py b/tests/test_cgitb_catcher.py
index 2b80d28..80d052e 100644
--- a/tests/test_cgitb_catcher.py
+++ b/tests/test_cgitb_catcher.py
@@ -45,7 +45,7 @@ def yielder(args):
def test_makes_exception():
res = do_request(bad_app)
- print res
+ print(res)
assert 'bad_app() takes no arguments (2 given' in res
assert 'iterator = application(environ, start_response_wrapper)' in res
assert 'lint.py' in res
@@ -53,20 +53,20 @@ def test_makes_exception():
def test_start_res():
res = do_request(start_response_app)
- print res
+ print(res)
assert 'ValueError: hi' in res
assert 'test_cgitb_catcher.py' in res
assert 'line 26, in start_response_app' in res
def test_after_start():
res = do_request(after_start_response_app, 200)
- print res
+ print(res)
assert 'ValueError: error2' in res
assert 'line 30' in res
def test_iter_app():
res = do_request(iter_app, 200)
- print res
+ print(res)
assert 'None raises error' in res
assert 'yielder' in res
diff --git a/tests/test_config.py b/tests/test_config.py
index 882f82c..ea6be75 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -40,7 +40,7 @@ def test_request_config_multi():
assert 'Variable is: test value' in res
assert 'Variable is (in environ): test value' in res
assert 'Nesting variable is: nesting value' in res
- print res
+ print(res)
assert 'Nesting variable is (in environ): nesting value' in res
def test_process_config(request_app=test_request_config):
diff --git a/tests/test_errordocument.py b/tests/test_errordocument.py
index 24f3022..c284b93 100644
--- a/tests/test_errordocument.py
+++ b/tests/test_errordocument.py
@@ -89,4 +89,4 @@ def test_bad_error():
app = forward(app, {404: '/404.html'})
app = TestApp(app)
resp = app.get('/test', expect_errors=True)
- print resp
+ print(resp)
diff --git a/tests/test_exceptions/test_formatter.py b/tests/test_exceptions/test_formatter.py
index 2fe4528..3d5bdad 100644
--- a/tests/test_exceptions/test_formatter.py
+++ b/tests/test_exceptions/test_formatter.py
@@ -74,7 +74,7 @@ def test_content():
raise_error()
except:
result = format(f)
- print result
+ print(result)
assert 'test_object' in result
assert 'http://whatever.com' in result
assert 'This is some supplemental information' in result
@@ -103,7 +103,7 @@ def test_hide():
hide(True, raise_error)
except:
result = format(f)
- print result
+ print(result)
assert 'in hide_inner' not in result
assert 'inner(*args, **kw)' not in result
else:
@@ -112,7 +112,7 @@ def test_hide():
def print_diff(s1, s2):
differ = difflib.Differ()
result = list(differ.compare(s1.splitlines(), s2.splitlines()))
- print '\n'.join(result)
+ print('\n'.join(result))
def test_hide_supppressed():
"""
@@ -153,7 +153,7 @@ def test_hide_after():
raise_error)
except:
result = format(f)
- print strip_html(result).encode('ascii', 'replace')
+ print(strip_html(result).encode('ascii', 'replace'))
assert 'AABB' in result
assert 'CCDD' not in result
assert 'raise_error' in result
@@ -169,7 +169,7 @@ def test_hide_before():
raise_error)
except:
result = format(f)
- print result
+ print(result)
assert 'AABB' not in result
assert 'raise_error' in result
else:
diff --git a/tests/test_exceptions/test_httpexceptions.py b/tests/test_exceptions/test_httpexceptions.py
index c833eae..08e23d4 100644
--- a/tests/test_exceptions/test_httpexceptions.py
+++ b/tests/test_exceptions/test_httpexceptions.py
@@ -72,10 +72,10 @@ def test_redapp():
assert "text/html" == header_value(saved[0][1], 'content-type')
assert "/bing/foo" == header_value(saved[0][1],'location')
result = list(app({'HTTP_ACCEPT': 'text/plain'},saveit))
- print result[0] == (
+ print(result[0] == (
'302 Found\n'
'This resource was found at /bing/foo;\n'
- 'you should be redirected automatically.\n')
+ 'you should be redirected automatically.\n'))
assert "text/plain; charset=utf8" == header_value(saved[1][1],'content-type')
assert "/bing/foo" == header_value(saved[1][1],'location')
diff --git a/tests/test_exceptions/test_reporter.py b/tests/test_exceptions/test_reporter.py
index 8f4dc7a..a40666e 100644
--- a/tests/test_exceptions/test_reporter.py
+++ b/tests/test_exceptions/test_reporter.py
@@ -44,7 +44,7 @@ def test_logger():
assert 0
rep.report(exc_data)
content = open(fn).read()
- print content
+ print(content)
assert len(content.splitlines()) == 8
assert 'ZeroDivisionError' in content
diff --git a/tests/test_fileapp.py b/tests/test_fileapp.py
index c0013fb..d5b2a95 100644
--- a/tests/test_fileapp.py
+++ b/tests/test_fileapp.py
@@ -106,7 +106,7 @@ def test_file():
assert content == res.body
assert content == app.content # this is cashed
lastmod = res.header('last-modified')
- print "updating", tempfile
+ print("updating", tempfile)
file = open(tempfile,"a+")
file.write("0123456789")
file.close()
diff --git a/tests/test_registry.py b/tests/test_registry.py
index 7af953f..dfece6a 100644
--- a/tests/test_registry.py
+++ b/tests/test_registry.py
@@ -109,7 +109,7 @@ def test_registry_no_object_error():
def test_with_default_object():
app = TestApp(simpleapp_withregistry_default)
res = app.get('/')
- print res
+ print(res)
assert 'Hello world' in res
assert "Value is {'hi': 'people'}" in res
diff --git a/tests/test_urlparser.py b/tests/test_urlparser.py
index f8c8b9f..d1f3377 100644
--- a/tests/test_urlparser.py
+++ b/tests/test_urlparser.py
@@ -58,7 +58,7 @@ def test_deep():
assert 'index2' in res
res = app.get('/sub')
assert res.status == 301
- print res
+ print(res)
assert res.header('location') == 'http://localhost/sub/'
assert 'http://localhost/sub/' in res
res = app.get('/sub/')