Skip to content

Commit

Permalink
test: use print() function on both Python 2 and 3
Browse files Browse the repository at this point in the history
PR-URL: #24485
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
cclauss authored and codebytere committed Jan 29, 2019
1 parent 2ffbde3 commit 40773c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
23 changes: 12 additions & 11 deletions test/message/testcfg.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down
23 changes: 12 additions & 11 deletions test/pseudo-tty/testcfg.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 40773c0

Please sign in to comment.