From 0c1fcd2b50908bda607fce70c796033e33832b11 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 11 Mar 2014 17:39:18 +0100 Subject: test: Make print calls compatible with Python 3 Turn print calls into print() function calls and avoid using comma-separated arguments, so that they work and look the same with both Python 2 and 3. --- test/test-advice-of-charge | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'test/test-advice-of-charge') diff --git a/test/test-advice-of-charge b/test/test-advice-of-charge index 9f3f6556..bb52f5b0 100755 --- a/test/test-advice-of-charge +++ b/test/test-advice-of-charge @@ -7,16 +7,16 @@ import dbus.mainloop.glib def cm_property_changed(name, value): - print "CallMeter property: '%s' changed to '%s'" % (name, str(value)) + print("CallMeter property: '%s' changed to '%s'" % (name, str(value))) if canexit: mainloop.quit() def cm_maximum_reached(): - print "Only 30 seconds call time remains, recharge." + print("Only 30 seconds call time remains, recharge.") def print_useage(s): - print "Usage: %s " % (s) - print "Usage: %s reset " % (s) + print("Usage: %s " % (s)) + print("Usage: %s reset " % (s)) sys.exit(1); if __name__ == "__main__": @@ -51,24 +51,24 @@ if __name__ == "__main__": properties = cm.GetProperties() - print "Currency: %s" % (properties['Currency']) - print "PricePerUnit %s" % (properties['PricePerUnit']) - print "Call meter for the current call: %s" % (properties['CallMeter']) - print "Call meter for current and previous calls: %s" %\ - properties['AccumulatedCallMeter'] - print "Call meter maximum, once reached calls are not possible: %s" %\ - properties['AccumulatedCallMeterMaximum'] + print("Currency: %s" % (properties['Currency'])) + print("PricePerUnit %s" % (properties['PricePerUnit'])) + print("Call meter for the current call: %s" % (properties['CallMeter'])) + print("Call meter for current and previous calls: %s" %\ + properties['AccumulatedCallMeter']) + print("Call meter maximum, once reached calls are not possible: %s" %\ + properties['AccumulatedCallMeterMaximum']) total = properties['PricePerUnit'] * properties['AccumulatedCallMeter'] - print "Accumulated Meter in Currency: %s %s" %\ - (total, properties['Currency']) + print("Accumulated Meter in Currency: %s %s" %\ + (total, properties['Currency'])) if (sys.argv[1] == 'reset'): - print "Resetting Accumulated Call Meter" + print("Resetting Accumulated Call Meter") try: cm.Reset(pin) except dbus.DBusException, e: - print "Unable to reset ACM: ", e + print("Unable to reset ACM: %s" % e) sys.exit(1) else: try: @@ -78,7 +78,7 @@ if __name__ == "__main__": newvalue = float(newvalue) cm.SetProperty(property, newvalue, pin) except dbus.DBusException, e: - print "Unable to set property: ", e + print("Unable to set property: %s" % e) sys.exit(1) canexit = True -- cgit v1.2.3