Commit 26ad0555 authored by David Gobbi's avatar David Gobbi
Browse files

Fix some converted python print statements.

Some quick py3k compatibility fixes caused these print statements
to generate much different output from before.  This fixes that.
parent b1f2f2c7
......@@ -38,7 +38,7 @@ except:
try:
b = vtk.vtkObject()
d = b.SafeDownCast(o)
print(b, d)
print(repr(b) + " " + repr(d))
except:
print("Cannot downcast")
sys.exit(1)
......
......@@ -8,7 +8,7 @@ arrayType = ['Bit', 'Char', 'Double', 'Float', 'Int', 'Long', 'Short',\
'UnsignedChar', 'UnsignedInt', 'UnsignedLong', 'UnsignedShort']
for array in arrayType:
print(array, 'array')
print(array + ' array')
vtkClass = 'vtk' + array + 'Array'
a = getattr(vtk, vtkClass)()
a.Allocate(1,1)
......
......@@ -438,12 +438,12 @@ def BatchTest(vtkClasses, batchNo, batchSize):
def PrintResultSummary():
print('-' * 40)
print('Empty Input worked:', len(emptyInputWorked))
print('Empty Input failed:', len(emptyInputFailed))
print('Abstract classes: ', len(abstractClasses))
print('Non-existent classes: ', len(nonexistentClasses))
print('No concrete implementation: ', len(noConcreteImplementation))
print('No observer could be added: ', len(noObserver))
print('Empty Input worked: %i' % len(emptyInputWorked))
print('Empty Input failed: %i' % len(emptyInputFailed))
print('Abstract classes: %i' % len(abstractClasses))
print('Non-existent classes: %i' % len(nonexistentClasses))
print('No concrete implementation: %i' % len(noConcreteImplementation))
print('No observer could be added: %i' % len(noObserver))
print('-' * 40)
print('Total number of classes tested: ', len(classesTested)) # , classesTested
print('-' * 40)
......
......@@ -14,7 +14,7 @@ from vtk.test import Testing
try:
import numpy
except ImportError:
print("Numpy (http://numpy.scipy.org) not found.",)
print("Numpy (http://numpy.scipy.org) not found.")
print("This test requires numpy!")
sys.exit(0)
......
......@@ -228,7 +228,7 @@ def TestOne(cname):
# Key is not present
setParameterFail[cname] = set(['Set' + m])
except Exception as err:
print(cname, 'Set' + m, err)
print(cname + 'Set' + m + ' ' + str(err))
except TypeError:
# Get...() takes 1 or more arguments.
try:
......@@ -239,7 +239,7 @@ def TestOne(cname):
# Key is not present
getParameterFail[cname] = set(['Get' + m])
except Exception as err:
print(cname, 'Get' + m, err)
print(cname + 'Get' + m + ' ' + str(err))
ok = setGetStatus
else:
noGetSetPairs.add(cname)
......@@ -346,16 +346,16 @@ def BatchTest(vtkClasses, batchNo, batchSize):
def PrintResultSummary():
print('-' * 40)
print('Set(Get()) worked:', len(setGetWorked))
print('Set(Get()) failed:', len(setGetFailed))
print('Abstract classes: ', len(abstractClasses))
print('Non-existent classes: ', len(nonexistentClasses))
print('No concrete implementation: ', len(noConcreteImplementation))
print('No observer could be added: ', len(noObserver))
print('Set(Get()) worked: %i' % len(setGetWorked))
print('Set(Get()) failed: %i' % len(setGetFailed))
print('Abstract classes: %i' % len(abstractClasses))
print('Non-existent classes: %i' % len(nonexistentClasses))
print('No concrete implementation: %i' % len(noConcreteImplementation))
print('No observer could be added: %i' % len(noObserver))
print('-' * 40)
print('Total number of classes tested: ', len(classesTested))
print('Total number of classes tested: %i' % len(classesTested))
print('-' * 40)
print('Excluded from testing: ', len(classExceptions))
print('Excluded from testing: %i' % len(classExceptions))
print('-' * 40)
def ProgramOptions():
......
......@@ -22,7 +22,7 @@ class Tester:
if obj != self.obj:
self.testParse(obj)
methods = self.parser.get_set_methods()
toggle = map(lambda x: x[:-2], self.parser.toggle_methods())
toggle = [x[:-2] for x in self.parser.toggle_methods()]
methods.extend(toggle)
for method in methods:
if method in excluded_methods:
......
......@@ -267,21 +267,21 @@ def _printCDashImageError(img_err, err_index, img_base):
"""Prints the XML data necessary for CDash."""
img_base = _getTempImagePath(img_base)
print("Failed image test with error: %f"%img_err)
print("<DartMeasurement name=\"ImageError\" type=\"numeric/double\">",)
print("%f </DartMeasurement>"%img_err)
print("<DartMeasurement name=\"ImageError\" type=\"numeric/double\"> "
"%f </DartMeasurement>"%img_err)
if err_index <= 0:
print("<DartMeasurement name=\"BaselineImage\" type=\"text/string\">Standard</DartMeasurement>",)
print("<DartMeasurement name=\"BaselineImage\" type=\"text/string\">Standard</DartMeasurement>")
else:
print("<DartMeasurement name=\"BaselineImage\" type=\"numeric/integer\">",)
print("%d </DartMeasurement>"%err_index)
print("<DartMeasurement name=\"BaselineImage\" type=\"numeric/integer\"> "
"%d </DartMeasurement>"%err_index)
print("<DartMeasurementFile name=\"TestImage\" type=\"image/png\">",)
print("%s </DartMeasurementFile>"%(img_base + '.png'))
print("<DartMeasurementFile name=\"TestImage\" type=\"image/png\"> "
"%s </DartMeasurementFile>"%(img_base + '.png'))
print("<DartMeasurementFile name=\"DifferenceImage\" type=\"image/png\">",)
print("%s </DartMeasurementFile>"%(img_base + '.diff.png'))
print("<DartMeasurementFile name=\"ValidImage\" type=\"image/png\">",)
print("%s </DartMeasurementFile>"%(img_base + '.valid.png'))
print("<DartMeasurementFile name=\"DifferenceImage\" type=\"image/png\"> "
"%s </DartMeasurementFile>"%(img_base + '.diff.png'))
print("<DartMeasurementFile name=\"ValidImage\" type=\"image/png\"> "
"%s </DartMeasurementFile>"%(img_base + '.valid.png'))
def _printCDashImageNotFoundError(img_fname):
"""Prints the XML data necessary for Dart when the baseline image is not found."""
......@@ -289,13 +289,13 @@ def _printCDashImageNotFoundError(img_fname):
def _printCDashImageSuccess(img_err, err_index):
"Prints XML data for Dart when image test succeeded."
print("<DartMeasurement name=\"ImageError\" type=\"numeric/double\">",)
print("%f </DartMeasurement>"%img_err)
print("<DartMeasurement name=\"ImageError\" type=\"numeric/double\"> "
"%f </DartMeasurement>"%img_err)
if err_index <= 0:
print("<DartMeasurement name=\"BaselineImage\" type=\"text/string\">Standard</DartMeasurement>",)
print("<DartMeasurement name=\"BaselineImage\" type=\"text/string\">Standard</DartMeasurement>")
else:
print("<DartMeasurement name=\"BaselineImage\" type=\"numeric/integer\">",)
print("%d </DartMeasurement>"%err_index)
print("<DartMeasurement name=\"BaselineImage\" type=\"numeric/integer\"> "
"%d </DartMeasurement>"%err_index)
def _handleFailedImage(idiff, pngr, img_fname):
......@@ -348,10 +348,10 @@ def main(cases):
tot_wall_time = float(time.time() - s_wall_time)
# output measurements for CDash
print("<DartMeasurement name=\"WallTime\" type=\"numeric/double\">",)
print(" %f </DartMeasurement>"%tot_wall_time)
print("<DartMeasurement name=\"CPUTime\" type=\"numeric/double\">",)
print(" %f </DartMeasurement>"%tot_time)
print("<DartMeasurement name=\"WallTime\" type=\"numeric/double\"> "
" %f </DartMeasurement>"%tot_wall_time)
print("<DartMeasurement name=\"CPUTime\" type=\"numeric/double\"> "
" %f </DartMeasurement>"%tot_time)
# Delete these to eliminate debug leaks warnings.
del cases, timer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment