[Python-modules-commits] [python-pyld] 153/276: Use 3.x print function support.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:48:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-pyld.

commit 9ac94c1fd353136212d75b3028cc9f885f91e32c
Author: David I. Lehn <dlehn at digitalbazaar.com>
Date:   Tue Aug 6 15:29:38 2013 -0400

    Use 3.x print function support.
---
 tests/runtests.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/tests/runtests.py b/tests/runtests.py
index 64db232..0f0ebec 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -9,6 +9,8 @@ Runs json-ld.org unit tests for JSON-LD.
 .. moduleauthor:: Mike Johnson
 """
 
+from __future__ import print_function
+
 __copyright__ = 'Copyright (c) 2011-2013 Digital Bazaar, Inc.'
 __license__ = 'New BSD license'
 
@@ -19,6 +21,7 @@ from optparse import OptionParser
 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
 from pyld import jsonld
 
+
 # supported test types
 TEST_TYPES = [
     'jld:ExpandTest',
@@ -91,8 +94,8 @@ class TestRunner:
         self.manifest_files = []
 
     def main(self):
-        print 'PyLD Unit Tests'
-        print 'Use -h or --help to view options.'
+        print('PyLD Unit Tests')
+        print('Use -h or --help to view options.')
 
         # add program options
         self.parser.add_option('-f', '--file', dest='file',
@@ -165,8 +168,8 @@ class TestRunner:
                     # print 'Skipping test: "%s" ...' % test['name']
                     continue
 
-                print 'JSON-LD/%s %04d/%s...' % (
-                    manifest['name'], count, test['name']),
+                print('JSON-LD/%s %04d/%s...' % (
+                    manifest['name'], count, test['name']), end=' ')
 
                 total += 1
                 count += 1
@@ -218,18 +221,18 @@ class TestRunner:
 
                     if success:
                         passed += 1
-                        print 'PASS'
+                        print('PASS')
                     else:
                         failed += 1
-                        print 'FAIL'
+                        print('FAIL')
 
                     if not success or self.options.verbose:
-                        print 'Expect:', json.dumps(expect, indent=2)
-                        print 'Result:', json.dumps(result, indent=2)
+                        print('Expect:', json.dumps(expect, indent=2))
+                        print('Result:', json.dumps(result, indent=2))
                 except jsonld.JsonLdError as e:
-                    print '\nError: ', e
+                    print('\nError: ', e)
                     failed += 1
-                    print 'FAIL'
+                    print('FAIL')
 
                 # add EARL report assertion
                 EARL['subjectOf'].append({
@@ -251,7 +254,7 @@ class TestRunner:
             f.write(json.dumps(EARL, indent=2))
             f.close()
 
-        print 'Done. Total:%d Passed:%d Failed:%d' % (total, passed, failed)
+        print('Done. Total:%d Passed:%d Failed:%d' % (total, passed, failed))
 
 def deep_compare(expect, result):
     if isinstance(expect, list):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list