From 40773c0f2ab73ddca244753c1e485ce7309fc4ed Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 19 Nov 2018 11:53:08 +0100 Subject: [PATCH] test: use print() function on both Python 2 and 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24485 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: Michaƫl Zasso --- test/message/testcfg.py | 23 ++++++++++++----------- test/pseudo-tty/testcfg.py | 23 ++++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/test/message/testcfg.py b/test/message/testcfg.py index 7e8d73bb39acd7..62776bcb7af0e2 100644 --- a/test/message/testcfg.py +++ b/test/message/testcfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Copyright 2008 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -67,22 +68,22 @@ def IsFailureOutput(self, output): raw_lines = (output.stdout + output.stderr).split('\n') outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ] if len(outlines) != len(patterns): - print "length differs." - print "expect=%d" % len(patterns) - print "actual=%d" % len(outlines) - print "patterns:" + print("length differs.") + print("expect=%d" % len(patterns)) + print("actual=%d" % len(outlines)) + print("patterns:") for i in xrange(len(patterns)): - print "pattern = %s" % patterns[i] - print "outlines:" + print("pattern = %s" % patterns[i]) + print("outlines:") for i in xrange(len(outlines)): - print "outline = %s" % outlines[i] + print("outline = %s" % outlines[i]) return True for i in xrange(len(patterns)): if not re.match(patterns[i], outlines[i]): - print "match failed" - print "line=%d" % i - print "expect=%s" % patterns[i] - print "actual=%s" % outlines[i] + print("match failed") + print("line=%d" % i) + print("expect=%s" % patterns[i]) + print("actual=%s" % outlines[i]) return True return False diff --git a/test/pseudo-tty/testcfg.py b/test/pseudo-tty/testcfg.py index a5b7917bc05a46..9289ce4f10d33a 100644 --- a/test/pseudo-tty/testcfg.py +++ b/test/pseudo-tty/testcfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Copyright 2008 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -65,22 +66,22 @@ def IsFailureOutput(self, output): raw_lines = (output.stdout + output.stderr).split('\n') outlines = [ s.strip() for s in raw_lines if not self.IgnoreLine(s) ] if len(outlines) != len(patterns): - print "length differs." - print "expect=%d" % len(patterns) - print "actual=%d" % len(outlines) - print "patterns:" + print("length differs.") + print("expect=%d" % len(patterns)) + print("actual=%d" % len(outlines)) + print("patterns:") for i in xrange(len(patterns)): - print "pattern = %s" % patterns[i] - print "outlines:" + print("pattern = %s" % patterns[i]) + print("outlines:") for i in xrange(len(outlines)): - print "outline = %s" % outlines[i] + print("outline = %s" % outlines[i]) return True for i in xrange(len(patterns)): if not re.match(patterns[i], outlines[i]): - print "match failed" - print "line=%d" % i - print "expect=%s" % patterns[i] - print "actual=%s" % outlines[i] + print("match failed") + print("line=%d" % i) + print("expect=%s" % patterns[i]) + print("actual=%s" % outlines[i]) return True return False